home *** CD-ROM | disk | FTP | other *** search
/ Enter 2000 January / ENTER_1_2000_2.iso / pelne / file scan for linux / filescanlinux / isinst < prev    next >
Encoding:
Text File  |  1999-10-20  |  86.5 KB  |  3,029 lines

  1. #!/bin/bash -login
  2. #
  3. # $Author: matt $
  4. # $Date: 1999/05/04 23:06:32 $
  5. #
  6. # $Log: isinst,v $
  7. # Revision 1.1  1999/05/04  23:06:32  matt
  8. # Initial revision
  9. #
  10. # Revision 1.1  1999/04/13  17:06:52  matt
  11. # Initial revision
  12. #
  13. # Revision 1.1  1999/03/22  19:08:29  matt
  14. # Initial revision
  15. #
  16. # Revision 1.15  99/03/18  09:47:11  09:47:11  alex ()
  17. # Fix tracker bugs 587, 588, 589, 592, and 594.
  18. # Revision 1.14  99/03/16  10:41:32  10:41:32  alex ()
  19. # Made following changes:
  20. # 1.  updated/modified list of base files
  21. # 2.  redirect tar error (generated when user is unknown) to /dev/null
  22. # 3.  update cgi-bin links in admin package
  23. # 4.  update default install dir to /opt/trend
  24. # Revision 1.13  1999/02/18 16:34:47  alex
  25. # Modified name of plugin instruction file.
  26. #
  27. # Revision 1.12  1999/02/12 07:38:33  alex
  28. # Addressed several issues.
  29. # 1.  Change the owndership of the Spamdb directory.
  30. # 2.  Move the prompting of plugin vs. sendmail to during the installaer than before installation.
  31. # 3.  Added error handling when pluginst fails to correctly modify users sendmail.cf file.
  32. #
  33. # Revision 1.11  99/02/10  16:20:04  16:20:04  alex ()
  34. # Added create/remove of Spamdb directory for anti-spamming features.
  35. # Revision 1.10  99/01/26  11:45:30  11:45:30  alex ()
  36. # Remove iscan.cat from ISADMIN installation.
  37. # Revision 1.9  99/01/21  17:26:40  17:26:40  alex ()
  38. # Fix bug with SMTP plugin removal that was leaving a file behind.
  39. # Revision 1.8  99/01/20  11:04:19  11:04:19  alex ()
  40. # Fixed bug in Exit() the was not starting daemons properly.
  41. # Revision 1.7  99/01/19  12:10:49  12:10:49  alex ()
  42. # Fix unable to start VirusWalls at exit.
  43. # Revision 1.6  99/01/19  08:30:51  08:30:51  alex ()
  44. # Adjust script to compensate for file differences between HP and Sol. Fix some minor bugs.
  45. # Revision 1.5  99/01/15  12:36:03  12:36:03  alex ()
  46. # Resolve missing/different files between HP and Solaris installation.
  47. # Revision 1.4  99/01/13  11:13:45  11:13:45  alex ()
  48. # Enhanced with SMTP plugin.
  49. # Revision 1.3  99/01/07  11:25:31  11:25:31  alex ()
  50. # General code cleanup.
  51. # Revision 1.2  99/01/06  11:52:53  11:52:53  alex ()
  52. # General code cleanup.
  53. # Revision 1.1  99/01/06  11:49:12  11:49:12  alex ()
  54. # Initial revision
  55. #
  56. #=============================================================
  57.  
  58. typeset INSTALLTYPE="Tar"
  59.  
  60. typeset DASH="--------"
  61. typeset BOLD=`tput bold`
  62. typeset UNBOLD=`tput rmso`
  63. typeset BELL=`tput bel`
  64.  
  65. #================== installation packages ====================
  66. typeset BASEPKG="isbase.tz"
  67. typeset FTPPKG="isftp.tz"
  68. typeset ADMINPKG="isadm.tz"
  69. typeset HTTPPKG="ishttp.tz"
  70. typeset SMTPPKG="issmtp.tz"
  71. typeset TVCSPKG="istvcs.tz"
  72. typeset CVPPKG="iscvp.tz"
  73. typeset INSTALLCVP="NO" 
  74. typeset ISPORS="issmtp"
  75.  
  76. #================== installed packages ====================
  77. typeset ISBASE="None"
  78. typeset ISFTP="None"
  79. typeset ISADMIN="None"
  80. typeset ISHTTP="None"
  81. typeset ISSMTP="None"
  82. typeset ISTVCS="None"
  83. typeset ISCVP="None"
  84. typeset PKG="IScan ISHTTP ISADMIN ISSMTP ISTVCS ISCVP"
  85.  
  86. #================== trial version flags  ====================
  87. typeset ISFTPTRIAL="0"
  88. typeset ISHTTPTRIAL="0"
  89. typeset ISSMTPTRIAL="0"
  90. typeset ISCVPTRIAL="0"
  91.  
  92. #================== packages to install  ====================
  93. typeset INSTFTP="NO"
  94. typeset INSTHTTP="NO"
  95. typeset INSTADMIN="NO"
  96. typeset INSTSMTP="NO"
  97. typeset INSTBASE="NO"
  98. typeset INSTTVCS="NO"
  99. typeset INSTCVP="NO"
  100.  
  101. #================== default installation paths ====================
  102. typeset FTPPATH="/opt/trend/ISFTP"
  103. typeset BASEPATH="/opt/trend/ISBASE"
  104. typeset SMTPPATH="/opt/trend/ISSMTP"
  105. typeset HTTPPATH="/opt/trend/ISHTTP"
  106. typeset ADMINPATH="/opt/trend/ISADMIN"
  107. typeset TVCSPATH="/opt/trend/ISTVCS"
  108. typeset CVPPATH="/opt/trend/ISCVP"
  109.  
  110. #================== installation files & dir =====================
  111. typeset BASEFILES="lpt\$vpn.518 cleanscan intscan.ini prescan.cgi srvscan vscan intscan.ini.orig upgrade uplog iscanpsw gentrial isgetcfg libvsapi.so geteng macr\$gen.517 macro.lst"
  112. typeset ADMINFILES=""
  113. typeset ADMINDIRS="bin cgi-bin config icons images msg Java"
  114. typeset FTPFILES="ISCANFTP iscanftp isftpd isftpd.trial"
  115. typeset HTTPFILES="ISCANHTTPPROXY  iscanhttpproxy  ishttpd ishttpd.trial"
  116. typeset SMTPFILES="ISCANSMTP iscansmtp issmtpd issmtpd.trial"
  117. typeset SMTPPLUGINFILES="isfilter isfilter.trial"
  118.  
  119. # UPGRADE determines whether existing .ini and .log files should
  120. # be restored after the base installation
  121. typeset UPGRADE="NO"
  122. typeset LICENSE="NOTOK"
  123. typeset OLDBASE=""
  124. typeset OLDHTTP=""
  125.  
  126. typeset RESP
  127.  
  128. # temporary installation path, set in ChkPath
  129. typeset ISPATH
  130.  
  131. function print
  132. {
  133.        echo -e $*
  134. }
  135.  
  136. function debug
  137. {
  138.     print -n "this is debug $1 message from matt."
  139. }
  140.  
  141. function PressAnyKey
  142. {
  143.     print
  144.     print -n "Press Enter to continue ..... " ; read
  145. }
  146.  
  147. #======================================================
  148. # IsTrialSW determines whether a given package is a trial
  149. # version. Flags are set up to indicate trial or not.
  150. #======================================================
  151. function IsTrialSW
  152. {
  153.   case $1 in
  154.   ISFTP )
  155.     if [ -s $FTPPATH/isftpd.trial ] ; then
  156.       ISFTPTRIAL=1
  157.     else
  158.       ISFTPTRIAL=0
  159.     fi ;;
  160.   ISSMTP )
  161.     test -s $SMTPPATH/issmtpd.trial || test -s $SMTPPATH/isfilter.trial 
  162.     if [ "$?" = "0" ] ; then
  163.       ISSMTPTRIAL=1
  164.     else
  165.       ISSMTPTRIAL=0
  166.     fi ;;
  167.   ISHTTP )
  168.     if [ -s $HTTPPATH/ishttpd.trial ] ; then
  169.       ISHTTPTRIAL=1
  170.     else
  171.       ISHTTPTRIAL=0
  172.     fi ;;
  173.   esac
  174. }
  175.  
  176. #======================================================
  177. # CheckSW will check to see whether a given package is
  178. # already installed. If a package is already installed
  179. # then a flag is set to indicate that. In addition, the
  180. # install request flag is cleared.
  181. #======================================================
  182. function CheckSW
  183. {
  184.   case $1 in
  185.   ISBASE )
  186.     if [ -s /etc/iscan/pkg/ISBASE ] ; then
  187.       ISBASE="Installed"
  188.       INSTBASE="NO"
  189.     fi ;;
  190.   ISFTP )
  191.     if [ -s /etc/iscan/pkg/ISFTP ] ; then
  192.       ISFTP="Installed"
  193.       INSTFTP="NO"
  194.     fi ;;
  195.   ISSMTP )
  196.     if [ -s /etc/iscan/pkg/ISSMTP ] ; then
  197.       ISSMTP="Installed"
  198.       INSTSMTP="NO"
  199.     fi ;;
  200.   ISHTTP )
  201.     if [ -s /etc/iscan/pkg/ISHTTP ] ; then
  202.       ISHTTP="Installed"
  203.       INSTHTTP="NO"
  204.     fi ;;
  205.   ISADMIN )
  206.     if [ -s /etc/iscan/pkg/ISADMIN ] ; then
  207.       ISADMIN="Installed"
  208.       INSTADMIN="NO"
  209.     fi ;;
  210.   ISTVCS )
  211.     if [ -s /etc/iscan/pkg/ISTVCS ] ; then
  212.       ISTVCS="Installed"
  213.       INSTTVCS="NO"
  214.     fi ;;
  215.   ISCVP ) 
  216.     if [ -s /etc/iscan/pkg/ISCVP ] ; then
  217.       ISCVP="Installed"
  218.       INSTCVP="NO"
  219.     fi ;;
  220.   esac
  221. }
  222.  
  223. #=================================================
  224. # ScanTrialPackages checks to see which packages
  225. # installed are trial versions and sets up flags
  226. # to indicate so.
  227. #=================================================
  228. function ScanTrialPackages
  229. {
  230.   IsTrialSW ISFTP
  231.   IsTrialSW ISHTTP
  232.   IsTrialSW ISSMTP
  233. }
  234.  
  235. #=================================================
  236. # ScanInstalledPackages checks to see which of the
  237. # InterScan packages are already installed.
  238. #=================================================
  239. function ScanInstalledPackages
  240. {
  241.   CheckSW ISBASE 
  242.   CheckSW ISFTP 
  243.   CheckSW ISADMIN 
  244.   CheckSW ISHTTP
  245.   CheckSW ISSMTP
  246.   CheckSW ISTVCS
  247.   CheckSW ISCVP
  248. }
  249.  
  250. #================================================
  251. # Header displays a standard header common to all 
  252. # menus in the installation script.
  253. #================================================
  254. function Header
  255. {
  256.   tput clear
  257.   print
  258.   print "\t\t\tTrend FileScan for Linux 1.0"
  259.   print
  260.   print "\t\t\t    Setup Script"
  261.   print
  262.   print " ---------------------------------------------------------------------"
  263.   print
  264. }
  265.  
  266. #=============================================================
  267. # ChkPath prompts the user to enter a path. The path the user
  268. # enters is checked to make sure it is not a reserved path and
  269. # that it is an absolute path (not relative).
  270. #=============================================================
  271. function ChkPath
  272. {
  273.   typeset firstchar
  274.  
  275.   print -n "\t\tNew Path is --- " ; read ISPATH
  276.   firstchar=`echo $ISPATH | cut -c1`
  277.   if [ "$firstchar" != "" ] ; then
  278.     if [ "$ISPATH" = "/etc/iscan" ] ; then
  279.       print ${BOLD}
  280.       print -n "\t\t$ISPATH is reserved for Trend FileScan for Linux internal use only."
  281.       print -n "\t\tPlease select a different path."
  282.       print ${UNBOLD}
  283.       PressAnyKey
  284.       ISPATH=`echo $1`
  285.     fi
  286.  
  287.     if [ "$firstchar" != "/" ] ; then
  288.       print -n "Path must be an ${BOLD}ABSOLUTE PATH${UNBOLD}."
  289.       PressAnyKey
  290.       ISPATH=`echo $1`
  291.     fi        
  292.   else
  293.     ISPATH=`echo $1`
  294.   fi
  295. }
  296.  
  297. #=======================================================================
  298. # ChkResp checks a NO/YES/QUIT user response. It only compares the first
  299. # character to make the decision so this routine must only be used with
  300. # the 3 responses listed above to prevent false matchings. Alternately,
  301. # the caller provides a default response that should be used if an 
  302. # invalid response is typed in by the user.
  303. #=======================================================================
  304. function ChkResp
  305. {
  306.   typeset firstchar
  307.  
  308.   firstchar=`echo $1 | cut -c1`
  309.   if [ "$firstchar" = "" ] ; then
  310.     RESP=$2 
  311.   fi
  312.  
  313.   case $1 in
  314.   [yY]* ) RESP=YES ;;
  315.   [nN]* ) RESP=NO ;;
  316.   [qQ]* ) RESP=QUIT ;;
  317.       * ) RESP=$2 ;;
  318.   esac
  319. }
  320.  
  321. #=====================================================
  322. # Called by SMTP installation only. Ask_For_Com_Domain
  323. # will modify /etc/intscan.ini with the correct domain
  324. # name for the company.
  325. #=====================================================
  326. function Ask_For_Com_Domain
  327. {
  328.    print "Please input the local internet domain name of your company : "
  329.    print -n "==> "
  330.    read DOMAIN
  331.    print
  332. ed /etc/iscan/intscan.ini << T_EOF > /dev/null 2>/dev/null
  333. /^company_domain
  334. s/company_domain=\(.*\)/company_domain=$DOMAIN/
  335. .
  336. w
  337. q
  338. T_EOF
  339.  
  340.    print "\tIf you want to modify your domain name, you can edit"
  341.    print "\t/etc/iscan/intscan.ini. Go into the [smtp] section and"
  342.    print "\tchange company_domain to the correct domain."
  343.    print
  344. }
  345.  
  346. #=================================================================
  347. # Iscan_or_Plugins displays a menu of choices to allow the user to
  348. # select whether they want to install the ISCAN SMTP or Sendmail
  349. # plugin.
  350. #=================================================================
  351. function Iscan_or_Plugins
  352. {
  353.    loop=true
  354.    while [ $loop = true ] ; do
  355.    loop=false
  356.  
  357.    Header
  358.    print
  359.    print "\t1.\tInterScan Viruswall SMTP."
  360.    print "\t2.\tInterScan VirusWall Plugins for Sendmail."
  361.    print
  362.    print -n "\t  \tSelect an option > " ; read RESP
  363.  
  364.    case $RESP in
  365.     1 ) ISPORS="issmtp" ;;
  366.     2 ) ISPORS="isplug" ;; 
  367.     * )    print "${BELL}\t\tAn invalid choice was entered. Please try again." ; loop=true ;; 
  368.    esac
  369.    done
  370. }
  371.  
  372. #=====================================================================
  373. # Modify allows the user to modify the installation defaults. When the
  374. # installation options are satisfactory, the user can then begin the
  375. # actual install.
  376. #=====================================================================
  377. function Modify
  378. {
  379.   print
  380.   print "\t\tPress Enter to accept the default shown above."
  381.   print -n "\t\tInstall Trend FileScan for Linux for $1? > "
  382.   read RESP
  383.  
  384.   # if the user enters a CR, then they want the default options displayed
  385.   if [ "$RESP" = "" ] ; then
  386.     return
  387.   fi
  388.     
  389.   case $1 in
  390.   "BASE" )
  391.     ChkResp $RESP $INSTBASE
  392.     if [ "$RESP" = "YES" ] ; then
  393.       ChkPath $BASEPATH
  394.       INSTBASE=YES
  395.       BASEPATH=`echo $ISPATH`
  396.     else
  397.       INSTBASE=NO
  398.     fi ;;
  399.     
  400.   "FTP" )
  401.     ChkResp $RESP $INSTFTP
  402.     if [ "$RESP" = "YES" ] ; then
  403.       ChkPath $FTPPATH
  404.       INSTFTP=YES 
  405.       FTPPATH=`echo $ISPATH`
  406.     else
  407.       INSTFTP=NO
  408.     fi ;;
  409.     
  410.   "HTTP" )
  411.     ChkResp $RESP $INSTHTTP
  412.     if [ "$RESP" = "YES" ] ; then
  413.       ChkPath $HTTPPATH
  414.       INSTHTTP=YES 
  415.       HTTPPATH=`echo $ISPATH`
  416.     else
  417.       INSTHTTP=NO
  418.     fi ;;
  419.     
  420.   "TVCS" )
  421.     ChkResp $RESP  $INSTTVCS
  422.     if [ "$RESP" = "YES" ] ; then
  423.       ChkPath $TVCSPATH
  424.       INSTTVCS=YES 
  425.       TVCSPATH=`echo $ISPATH`
  426.     else
  427.       INSTTVCS=NO
  428.     fi ;;
  429.     
  430.   "SMTP" )
  431.     ChkResp $RESP  $INSTSMTP
  432.     if [ "$RESP" = "YES" ] ; then
  433.       ChkPath $SMTPPATH
  434.       INSTSMTP=YES 
  435.       SMTPPATH=`echo $ISPATH`
  436.     else
  437.       INSTSMTP=NO
  438.     fi ;;
  439.     
  440.   "ADMIN" )
  441.     ChkResp $RESP  $INSTADMIN
  442.     if [ "$RESP" = "YES" ] ; then
  443.       ChkPath $ADMINPATH
  444.       INSTADMIN=YES 
  445.       ADMINPATH=`echo $ISPATH`
  446.     else
  447.       INSTADMIN=NO
  448.     fi  ;;
  449.     
  450.   "CVP" )
  451.     ChkResp $RESP  $INSTCVP
  452.     if [ "$RESP" = "YES" ] ; then
  453.       ChkPath $CVPPATH
  454.       INSTCVP=YES
  455.       CVPPATH=`echo $ISPATH`
  456.     else
  457.       INSTCVP=NO
  458.     fi ;;
  459.   esac
  460. }
  461.  
  462. #=========================================
  463. # FailMsg is not used in this file at all.
  464. #=========================================
  465. function FailMsg 
  466. {
  467.   print "${BOLD}"
  468.   print "\t\tTrend FileScan for Linux $1 has been installed but not properly"
  469.   print "\t\tsetup in your system, please contact your support channel."
  470.   print "${UNBOLD}"
  471. }
  472.  
  473. #====================================================
  474. # StartInstall does the actual package installations.
  475. #====================================================
  476. function StartInstall
  477. {
  478.   Header
  479.   grep "release 6" /etc/issue
  480.   if [ "$?" != "0" ] ; then
  481.      print $BOLD
  482.      print "\tTrend FileScan for Linux now only support running on Linux 6.0 or above"
  483.      print $UNBOLD
  484.      PressAnyKey
  485.      return
  486.   fi
  487.  
  488.   if [  "$ISBASE" = "None" -a "$INSTBASE" = "NO" ] ; then
  489.     print $BOLD
  490.     print "\tYou must install Trend FileScan for Linux Base system."
  491.     print $UNBOLD
  492.     PressAnyKey
  493.     return 
  494.   fi
  495.   print "Checking for installed sub-systems."
  496.   test "$INSTBASE" = "YES" -a "$ISBASE" = "Installed"
  497.   if [ "$?" = "0" ] ; then 
  498.     print "InterScan Trend FileScan for Linux Base is already installed."
  499.     INSTBASE="NO"
  500.   fi
  501.   test "$INSTADMIN" = "YES" -a "$ISADMIN" = "Installed"
  502.   if [ "$?" = "0" ] ; then
  503.     print "InterScan Trend FileScan for Linux CGI ADMIN is already installed."
  504.     INSTADMIN="NO"
  505.   fi
  506.   if [ "$ISFTP" = "Installed" ] ; then
  507.     print "InterScan VirusWall for FTP is installed."
  508.   fi
  509.   if [ "$ISHTTP" = "Installed" ] ; then
  510.     print "InterScan VirusWall for HTTP is installed."
  511.   fi
  512.   if [ "$ISSMTP" = "Installed" ] ; then
  513.     print "InterScan VirusWall for SMTP is installed."
  514.   fi
  515.   if [ "$ISTVCS" = "Installed" ] ; then
  516.     print "InterScan VirusWall for TVCS is installed."
  517.   fi
  518.   test "$INSTTVCS" = "YES" && test "$ISADMIN" = "None" && test "$INSTADMIN" = "NO" 
  519.   if [ "$?" = "0" ] ; then
  520.     print ""
  521.     print "To install InterScan VirusWall for TVCS, you must first"
  522.     print "  install InterScan VirusWall for CGI ADMIN."
  523.     INSTTVCS="NO"
  524.   fi
  525.  
  526.   # CVP installation should not come here
  527.   if [ $INSTALLCVP = "NO" ] ; then
  528.  
  529.     # set file creation mode
  530.     umask 222
  531.  
  532.     #==================#
  533.     # Install INSTBASE #
  534.     #==================#
  535.     if [ "$INSTBASE" = "YES" ] ; then
  536.     
  537.       # BASE for HP
  538.       if [ "$INSTALLTYPE" = "Tar" ] ; then
  539.         if [ -d /etc/iscan ] ; then
  540.           print "${BOLD}\tPlease uninstall the existing version of Trend FileScan for Linux"
  541.       print "\tbefore installing a new version.${UNBOLD}"
  542.         else
  543.           BaseInstallUsingTar
  544.         fi
  545.       fi
  546.     fi
  547.  
  548.     #===================#
  549.     # Install INSTADMIN #
  550.     #===================#
  551.     if [ "$INSTADMIN" = "YES" ] ; then
  552.       # ADMIN for HP
  553.       if [ "$INSTALLTYPE" = "Tar" ] ; then
  554.         AdminInstallUsingTar
  555.       else
  556.         InstallADMOnly 
  557.       fi
  558.     fi
  559.  
  560.     ScanTrialPackages
  561.     # check software license only if ISFTP or ISHTTP or ISSMTP is being installed
  562.     test "$INSTFTP" = "YES" || test "$INSTHTTP" = "YES" || test "$INSTSMTP" = "YES"
  563.     if [  "$?" = "0" ] ; then
  564.       CheckLicense
  565.     fi
  566.  
  567.     #===============#
  568.     # Install ISFTP #
  569.     #===============#
  570.     if [ "$INSTFTP" = "YES" ] ; then
  571.       # FTP for HP
  572.       if [ "$INSTALLTYPE" = "Tar" ] ; then
  573.         FTPInstallUsingTar
  574.       fi
  575.     fi
  576.  
  577.     #==============#
  578.     # Install HTTP #
  579.     #==============#
  580.     if [ "$INSTHTTP" = "YES" ] ; then
  581.  
  582.       # HTTP for HP
  583.       if [ "$INSTALLTYPE" = "Tar" ] ; then
  584.         HTTPInstallUsingTar
  585.       fi
  586.     fi
  587.  
  588.     #==============#
  589.     # Install SMTP #
  590.     #==============#
  591.     if [ "$INSTSMTP" = "YES" ] ; then
  592.  
  593.       # SMTP for HP
  594.       if [ "$INSTALLTYPE" = "Tar" ] ; then
  595.         SMTPInstallUsingTar
  596.       fi
  597. #      Ask_For_Com_Domain
  598.     fi
  599.  
  600.     #==============#
  601.     # Install TVCS #
  602.     #==============#
  603.     if [ "$INSTTVCS" = "YES" ] ; then
  604.       
  605.       # TVCS for HP
  606.       if [ "$INSTALLTYPE" = "Tar" ] ; then
  607.         TVCSInstallUsingTar
  608.       fi
  609.     fi
  610.  
  611.   else
  612.     # start install CVP 
  613.     StartInstallCVP
  614.   fi
  615.  
  616.   RESP=""
  617.   test "$ISFTPTRIAL" = "YES" || test "$ISHTTPTRIAL" = "YES" || \
  618.         test "$ISSMTPTRIAL" = "YES" || test "$ISCVPTRIAL" = "YES" 
  619.   if [ "$?" = "0" ] ; then
  620.     TRIAL_DAYS=30
  621.     LIC=`/etc/iscan/gentrial $TRIAL_DAYS`
  622.  
  623.     echo
  624.     echo "    This trial version of InterScan will expire in 30 days, after which"
  625.     echo "    virus protection on your system will be disabled. To ensure continuous"
  626.     echo "    protection please purchase InterScan VirusWall. Check the following"
  627.     echo "    URL for more information: http://www.antivirus.com/buy/index.htm"
  628.     echo 
  629.  
  630.     PressAnyKey
  631.     ADDRESS=root
  632.  
  633.     if [ "$UPGRADE" = "YES" ] ; then
  634.       grep "license=" /etc/iscan/intscan.ini
  635.       if [ "$?" != "0" ] ; then
  636.  
  637. ed /etc/iscan/intscan.ini << T_EOF > /dev/null 2>/dev/null
  638. /HttpScan=
  639. i
  640. license=xxxxxx
  641. .
  642. w
  643. q
  644. T_EOF
  645.  
  646.       fi
  647.     fi
  648.  
  649.     if [ "$LIC" != "" ] ; then
  650.       sed -e 's/license=xxxxxx/license='$LIC'/' < /etc/iscan/intscan.ini > /tmp/iscandd
  651.       \cp /tmp/iscandd /etc/iscan/intscan.ini
  652.     fi
  653.  
  654.     CUR_PWD=`pwd`
  655.     cd /tmp
  656.     echo "echo \"The trial version of InterScan VirusWall you have installed will expire in: 28 DAYS. For infomation on how you upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 2day" 2>/tmp/tmpid
  657.     echo "echo \"The trial version of InterScan VirusWall you have installed will expire in: 21 DAYS. For infomation on how you upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 9day" 2>>/tmp/tmpid
  658.     echo "echo \"The trial version of InterScan VirusWall you have installed will expire in: 14 DAYS. For infomation on how you upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 16day" 2>>/tmp/tmpid
  659.     echo "echo \"The trial version of InterScan VirusWall you have installed will expire in: 7 DAYS. For infomation on how you upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 23day" 2>>/tmp/tmpid
  660.     echo "echo \"The trial version of InterScan VirusWall you have installed on your system has expired. For information on how you can upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 30day" 2>>/tmp/tmpid
  661.     echo "echo \"# expire is yes\" >> /etc/iscan/intscan.ini" | at now "+ 30day" 2>>/tmp/tmpid
  662.     cd $CUR_PWD
  663.     ATID=`grep job /tmp/tmpid | cut -d' ' -f2`
  664.     for ind in ${ATID} ; do
  665.       echo "# notify_id is ${ind}" >> /etc/iscan/intscan.ini
  666.     done
  667.     rm -f /tmp/tmpid
  668.     rm -f /tmp/iscandd
  669.     cat /dev/null > /etc/iscan/gentrial
  670.     TRIAL="NO"
  671.   else
  672.     PressAnyKey
  673.   fi
  674. }
  675.  
  676. #==========================================================
  677. # Install presents the user with a menu that allows them to
  678. # modify the install options and paths for the individual
  679. # ISCAN packages.
  680. #==========================================================
  681. function Install
  682. {
  683.  
  684.     StartInstall
  685.     MainMenu 
  686.   # Check if Install CVP already, need to remove it first.
  687. #  if [ $ISCVP = "Installed" ] ; then
  688. #    print "Please remove CVP before proceeding with install."
  689. #    return
  690. #  fi
  691.  
  692. #  while ( true ); do
  693. #    Header
  694. #    DisplayInstallationOptions ALL
  695. #    print
  696. #    print "\tInstall Menu"
  697. #    print
  698. #    print "\t1.\tModify option for Trend FileScan for Linux for BASE."
  699. #    print "\t2.\tModify option for Trend FileScan for Linux for ADMIN."
  700. #    print "\t3.\tStart installation."
  701. #    print "\t4.\tReturn to the previous menu."
  702. #    print "\t5.\tExit."
  703. #    print 
  704. #    print -n "\t\tSelect a number > " ; read RESP ; 
  705.  
  706.  #   case $RESP in
  707.  #   1  ) DisplayInstallationOptions BASE
  708.  #        Modify BASE ;;
  709.  #   2  ) DisplayInstallationOptions ADMIN
  710.  #        Modify ADMIN ;;
  711.  #   3  ) StartInstall ;;
  712.  #   4  ) MainMenu ;;
  713.  #   5 ) Exit ;;
  714.  #   *  ) print "${BELL}\t\tInvalid choice. Please try again."
  715.  #       PressAnyKey ;;
  716.  #   esac
  717.  # done
  718. }
  719.  
  720. #====================================================================
  721. # StartRemove does the actual removal of the individual packages. The
  722. # package to remove is passed in as the first parameter.
  723. #====================================================================
  724. function StartRemove
  725. {
  726.   case $1 in 
  727.  
  728.   #=============#
  729.   # BASE System #
  730.   #=============#
  731.   BASE )
  732.     if [ "$ISBASE" = "None" ] ; then
  733.       print $BOLD
  734.       print "\t\tTrend FileScan for Linux BASE package is not installed."
  735.       print $UNBOLD
  736.       PressAnyKey
  737.       return
  738.     fi 
  739.  
  740.     for i in $ISFTP $ISHTTP $ISADMIN $ISSMTP $ISCVP $ISTVCS; do
  741.       if [ "$i" = "Installed" ] ; then
  742.       print $BOLD
  743.       print "\t\tPlease remove other sub-system(s) first"
  744.       print "\t\tbefore removing $1 System."
  745.       print $UNBOLD
  746.       PressAnyKey
  747.       return
  748.       fi
  749.     done
  750.     Header
  751.     print $BOLD
  752.     print "\t\tRemoving Trend FileScan for Linux $1 package means no "
  753.     print "\t\tVirus Scan functionality will exist on the system. "
  754.     print -n "\t\tDo you want to remove this package? > "
  755.     read RESP
  756.     print $UNBOLD
  757.     ChkResp $RESP "NO"
  758.     if [ "$RESP" = "NO" ] ; then
  759.       return
  760.     fi
  761.  
  762.     # remove BASE for HP
  763.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  764.       BaseRemoveUsingTar
  765.     # remove BASE for Solaris
  766.     elif [ "$INSTALLTYPE" = "AddPkg" ] ; then
  767.       pkgrm -R `cat /etc/iscan/pkg/ISBASE` ISBASE
  768.       if [ "$?" = "0"  -a ! -r /etc/iscan ] ; then
  769.         ISBASE="None"    
  770.     INSTBASE="YES"
  771.       fi
  772.     fi ;;
  773.  
  774.   #==============#
  775.   # ADMIN System #
  776.   #==============#
  777.   ADMIN )
  778.     if [ "$ISADMIN" = "None" ] ; then
  779.       print ${BOLD}
  780.       print "\t\tTrend FileScan for Linux ADMIN package is not installed."
  781.       print ${UNBOLD}
  782.       PressAnyKey
  783.       return
  784.     fi
  785.  
  786.     Header
  787.     # ADMIN cannot be removed if CVP/TVCS is installed
  788.     test "$ISCVP" = "Installed" -o "$ISTVCS" = "Installed" 
  789.     if [ "$?" = "0" ] ; then 
  790.       print $BOLD
  791.       print -n "\t\tPlease remove InterScan for "
  792.       if [ "$ISCVP" = "Installed" ] ; then
  793.         print -n "CVP"
  794.       fi
  795.       if [ "$ISTVCS" = "Installed" ] ; then
  796.         print "TVCS"
  797.       fi
  798.       print "\t\tbefore removing InterScan for $1."
  799.       print $UNBOLD
  800.       PressAnyKey
  801.       return
  802.     fi
  803.  
  804.     print $BOLD
  805.     print "\t\tRemoving the Trend FileScan for Linux $1 package,  "
  806.     print "\t\tyou will not be able to configure Trend FileScan "
  807.     print "\t\tfor Linux from a web browser. " 
  808.     print -n "\t\tDo you want to remove this package? > "
  809.     read RESP
  810.     print $UNBOLD
  811.     ChkResp $RESP "NO"
  812.     if [ "$RESP" = "NO" ] ; then
  813.       return
  814.     fi
  815.  
  816.     # remove BASE for HP
  817.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  818.       AdminRemoveUsingTar
  819.     # remove BASE for Solaris
  820.     elif [ "$INSTALLTYPE" = "AddPkg" ] ; then
  821.       pkgrm -R `cat /etc/iscan/pkg/ISADMIN` ISADMIN
  822.       test "$?" = "0" && ! -s /etc/rc.d/rc3.d/S99IScanHttpd 
  823.       if [ "$?" = "0" ] ; then
  824.         ISADMIN="None"    
  825.         INSTADMIN="YES"
  826.       fi
  827.     fi ;;
  828.  
  829.   #============#
  830.   # FTP System #
  831.   #============#
  832.   FTP )
  833.     if [ "$ISFTP" = "None" ] ; then
  834.       print $BOLD
  835.       print "\t\tInterScan FTP package is not installed."
  836.       print $UNBOLD
  837.       PressAnyKey
  838.       return
  839.     fi
  840.  
  841.     Header
  842.     print $BOLD
  843.     print "\t\tRemoving InterScan $1 VirusWall means your network users"
  844.     print "\t\twill lose virus protection on their network file transfers."
  845.     print -n "\t\tDo you want to remove this package? > "
  846.     read RESP
  847.     print $UNBOLD
  848.     ChkResp $RESP "NO"
  849.     if [ "$RESP" = "NO" ] ; then
  850.       return
  851.     fi
  852.  
  853.     # remove BASE for HP
  854.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  855.       FTPRemoveUsingTar
  856.     # remove BASE for Solaris
  857.     elif [ "$INSTALLTYPE" = "AddPkg" ] ; then
  858.       pkgrm -R `cat /etc/iscan/pkg/ISFTP` ISFTP
  859.       if [ "$?" = "0" -a ! -s /etc/iscan/isftpd ] ; then
  860.         ISFTP="None"
  861.     INSTFTP="YES"
  862.       fi
  863.  
  864.       ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4`
  865.       for ind in ${ATID}; do
  866.         atrm $ind
  867.       done
  868.       sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$
  869.       \mv /tmp/iscan$$ /etc/iscan/intscan.ini
  870.     fi ;;
  871.  
  872.   #=============#
  873.   # SMTP System #
  874.   #=============#
  875.   SMTP )
  876.     if [ "$ISSMTP" = "None" ] ; then
  877.       print $BOLD
  878.       print "\t\tInterScan SMTP package is not installed."
  879.       print $UNBOLD
  880.       PressAnyKey
  881.       return
  882.     fi
  883.  
  884.     Header
  885.     print $BOLD
  886.     print "\t\tRemoving InterScan $1 VirusWall means your network users"
  887.     print "\t\twill lose virus protection on their e-mail transmissions."
  888.     print -n "\t\tDo you want to remove this package? > "
  889.     read RESP
  890.     print $UNBOLD
  891.     ChkResp $RESP "NO"
  892.     if [ "$RESP" = "NO" ] ; then
  893.       return
  894.     fi
  895.  
  896.     # remove SMTP for HP
  897.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  898.       SMTPRemoveUsingTar
  899.     # remove SMTP for Solaris
  900.     elif [ "$INSTALLTYPE" = "AddPkg" ] ; then
  901.       pkgrm -R `cat /etc/iscan/pkg/ISSMTP` ISSMTP
  902.       test "$?" = "0" && ! -s /etc/iscan/sendmail 
  903.       if [ "$?" = "0"  ] ; then
  904.         ISSMTP="None"
  905.     INSTSMTP="YES"
  906.       fi
  907.     
  908.       ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4`
  909.       for ind in ${ATID}; do
  910.         atrm $ind
  911.       done
  912.       sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$
  913.       \mv /tmp/iscan$$ /etc/iscan/intscan.ini
  914.     fi ;;
  915.  
  916.   #=============#
  917.   # HTTP System #
  918.   #=============#
  919.   HTTP )
  920.     if [ "$ISHTTP" = "None" ] ; then
  921.       print $BOLD
  922.       print "\t\tInterScan HTTP package is not installed."
  923.       print $UNBOLD
  924.       PressAnyKey
  925.       return
  926.     fi
  927.  
  928.     Header
  929.     print $BOLD
  930.     print "\t\tRemoving InterScan $1 VirusWall means your network users"
  931.     print "\t\twill lose virus protection on their Internet and intranet"
  932.     print -n "\t\tfile transfers. Do you want to remove this package? > "
  933.     read RESP
  934.     print $UNBOLD
  935.     ChkResp $RESP "NO"
  936.     if [ "$RESP" = "NO" ] ; then
  937.       return
  938.     fi
  939.  
  940.     # remove HTTP for HP
  941.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  942.       HTTPRemoveUsingTar
  943.     # remove HTTP for Solaris
  944.     elif [ "$INSTALLTYPE" = "AddPkg" ] ; then
  945.       pkgrm -R `cat /etc/iscan/pkg/ISHTTP` ISHTTP
  946.       test "$?" = "0" && ! -s /etc/iscan/ishttpd 
  947.       if [  "$?" = "0" ] ; then
  948.     ISHTTP="None"
  949.     INSTHTTP="YES"
  950.       fi
  951.  
  952.       ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4`
  953.       for ind in ${ATID}; do
  954.         atrm $ind
  955.       done
  956.       sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$
  957.       \mv /tmp/iscan$$ /etc/iscan/intscan.ini
  958.     fi ;;
  959.  
  960.   #=============#
  961.   # TVCS System #
  962.   #=============#
  963.   TVCS )
  964.     if [ "$ISTVCS" = "None" ] ; then
  965.       print $BOLD
  966.       print "\t\tInterScan TVCS package is not installed."
  967.       print $UNBOLD
  968.       PressAnyKey
  969.       return
  970.     fi
  971.  
  972.     Header
  973.     print $BOLD
  974.     print "\t\tPlease have your TVCS administrator remove this InterScan"
  975.     print "\t\tregistration from TVCS console."
  976.     print $UNBOLD
  977.  
  978.     # remove TVCS for HP
  979.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  980.       TVCSRemoveUsingTar
  981.      # remove TVCS for Solaris
  982.     elif [ "$INSTALLTYPE" = "AddPkg" ] ; then
  983.       pkgrm -R `cat /etc/iscan/pkg/ISTVCS` ISTVCS
  984.       if [ "$?" = "0" ] ; then
  985.     ISTVCS="None"    
  986.     INSTTVCS="YES" 
  987.       fi
  988.       
  989. ed /etc/iscan/intscan.ini <<EOF >/dev/null 2>/dev/null 2>/dev/null
  990. /\[TVCS
  991. .,+14d
  992. .
  993. w
  994. q
  995. EOF
  996.  
  997.     fi ;;
  998.  
  999.   #=============#
  1000.   # CVP System #
  1001.   #=============#
  1002.   CVP )
  1003.     # CVP is not supported in HP
  1004.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  1005.       return
  1006.     fi
  1007.  
  1008.     if [ "$ISCVP" = "Installed" ] ; then
  1009.       Header
  1010.       pkgrm -R `cat /etc/iscan/pkg/ISCVP` ISCVP
  1011.       rm -f /etc/iscan/pkg/ISCVPON
  1012.       if [ "$?" = "0" && ! -s /etc/iscan/iscvp ] ; then
  1013.     ISCVP="None"
  1014.     INSTCVP="YES"
  1015.     ISCVPTRIAL="0" 
  1016.       fi 
  1017.     else
  1018.       print ${BOLD}
  1019.       print "\t\tYou haven't install InterScan CVP yet "
  1020.       print ${UNBOLD}
  1021.       return 
  1022.     fi
  1023.  
  1024.     ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4`
  1025.     for ind in ${ATID}; do
  1026.       atrm $ind
  1027.     done
  1028.     sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$
  1029.     \mv /tmp/iscan$$ /etc/iscan/intscan.ini ;;
  1030.   esac
  1031.  
  1032.   # if there are no more trial software installed then remove all at jobs
  1033.   ScanTrialPackages
  1034.   remove_at=0
  1035.   test -s /etc/iscan/intscan.ini && test "$ISFTPTRIAL" != 1 && \
  1036.   test "$ISHTTPTRIAL" != "1" -a "$ISSMTPTRIAL" != "1" 
  1037.   if [ "$?" = "0" ] ; then
  1038.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  1039.       remove_at=1
  1040.     elif [ "$ISCVPTRIAL" != 1 ] ; then
  1041.       remove_at=1
  1042.     fi
  1043.   fi
  1044.   
  1045.   if [ "$remove_at" = 1 ] ; then
  1046.     ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4`
  1047.     for ind in $ATID ; do
  1048.       atrm $ind
  1049.     done
  1050.     sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$
  1051.     \mv /tmp/iscan$$ /etc/iscan/intscan.ini
  1052.   fi
  1053.  
  1054.   PressAnyKey
  1055. }
  1056.  
  1057. #========================================================
  1058. # Remove presents a menu to the user which allows them to
  1059. # select a particular package for removal or to remove
  1060. # all packages.
  1061. #========================================================
  1062. function Remove
  1063. {
  1064.     RemoveAll
  1065.     MainMenu 
  1066.  # while [ true ] ; do
  1067.  #   Header
  1068.  #   print "\tRemove Menu"
  1069.  #   print
  1070.  #   print "\t1.\tRemove Trend FileScan for Linux Base System."
  1071.  #   print "\t2.\tRemove Trend FileScan for Linux Admin System."
  1072.  #   print "\t3.\tRemove All Trend FileScan for Linux System."
  1073.  #   print "\t4.\tReturn to the previous menu."
  1074.  #   print "\t5.\tExit."
  1075.  #   print 
  1076.  #   print -n "\t\tSelect a number > "
  1077.  #   read RESP
  1078.  
  1079.   #  case $RESP in
  1080.   #  1 ) StartRemove "BASE" ;;
  1081.   #  2 ) StartRemove "ADMIN" ;;
  1082.   #  3 ) RemoveAll ;;
  1083.   #  4 ) MainMenu ;;
  1084.   #  5 ) Exit ;;
  1085.   #  * ) print "${BELL}\t\tInvalid choice. Please try again."
  1086.   #      PressAnyKey ;;
  1087.   #  esac
  1088.  # done
  1089. }
  1090.  
  1091. #============
  1092. # CVP routine
  1093. #============
  1094. function RemoveCVP 
  1095. {
  1096.     typeset RESPCVP
  1097.  
  1098.     while (true) ; do 
  1099.     Header
  1100.     print
  1101.     print "\t1.\tRemove InterScan VirusWall Base System."
  1102.     print "\t2.\tRemove InterScan VirusWall Admin System."
  1103.     print "\t3.\tRemove InterScan VirusWall CVP System."
  1104.     print "\t4.\tRemove InterScan VirusWall TVCS System."
  1105.     print "\t5.\tRemove All InterScan VirusWall System."
  1106.     print "\t6.\tBack to Main Menu."
  1107.     print
  1108.         print -n "              Select a number > ";read RESPCVP
  1109.         case $RESPCVP in
  1110.     1 )StartRemove "BASE" ;;
  1111.     2 )StartRemove "ADMIN" ;;
  1112.     3 )StartRemove "CVP" ;;
  1113.     4 )StartRemove "TVCS" ;;
  1114.     5 )RemoveAll ;; 
  1115.     6 )MainMenuCVP ;; 
  1116.     * ) print "${BELL}\t\tAn invalid choice was entered. Please try again."
  1117.     esac
  1118.     done
  1119. }    
  1120.  
  1121. #============================================================================
  1122. # Exit terminates the installation. Additionally, it prompts the user whether
  1123. # they want to start VirusWall or not.
  1124. #============================================================================
  1125. function Exit
  1126. {
  1127.   # remove temporary support directory
  1128.   rm -rf /tmp/iscan_support
  1129.  
  1130.   if [ ! -s /etc/iscan ] ; then
  1131.     exit 0
  1132.   fi
  1133.     print
  1134.     print "\tYou can configure Trend FileScan for Linux via"
  1135.     print "\ttype in the URL: http://your-host-name:1812/interscan "
  1136.     print "\ton the web browser."
  1137.     print
  1138.     PressAnyKey
  1139.   exit 0
  1140. }
  1141.  
  1142. #=======================================================
  1143. # ConfigIScanUsingBrowser launches a browser connecting with port 
  1144. # 1812.
  1145. # NOTE: the function terminates installation.
  1146. #=======================================================
  1147. function ConfigIScanUsingBrowser
  1148. {
  1149.   typeset NETSCAPE
  1150.   typeset BROWSER
  1151.   typeset BROWSERPATH
  1152.   typeset firstchar
  1153.   typeset HOSTNAME
  1154.  
  1155.   if [ "$ISADMIN" != "Installed" ] ; then
  1156.     print ${BOLD}
  1157.     print "\t\tPlease install the Trend FileScan for Linux ADMIN package first."
  1158.     print ${UNBOLD}
  1159.     PressAnyKey
  1160.       return
  1161.   fi
  1162.   Header
  1163.   print -n "\tPlease identify the browser you use [netscape]: "
  1164.   read BROWSER
  1165.  
  1166.   # NETSCAPE will be set to the browser entered by the user or
  1167.   # netscape if the user did not enter anything
  1168.   NETSCAPE=${BROWSER:-"netscape"}
  1169.   BROWSER=`/usr/bin/which $NETSCAPE 2> /dev/null`
  1170.  
  1171.   # browser was not found, prompt the user for the path
  1172.   if [ ! -s $BROWSER ] ; then
  1173.     print -n "\tEnter the full path to your browser: "
  1174.     read BROWSERPATH
  1175.     if [ ! -s $BROWSERPATH/$NETSCAPE ] ; then
  1176.       print $BOLD
  1177.       print "\t\t$BROWSERPATH/$NETSCAPE does not exist."
  1178.       print $UNBOLD
  1179.       PressAnyKey
  1180.  
  1181.       # before return, is there an alternate method to config
  1182.       # IScan that should be presented to the user?
  1183.  
  1184.       return
  1185.     fi    
  1186.     HOSTNAME=`hostname`
  1187.     NETSCAPE=`echo $BROWSERPATH/$NETSCAPE`
  1188.   else
  1189.     HOSTNAME=`hostname`
  1190.     NETSCAPE=`echo $NETSCAPE`
  1191.   fi
  1192.  
  1193.   # launch the browser
  1194.   exec $NETSCAPE $HOSTNAME:1812/interscan &
  1195.  
  1196.   # terminate installation script
  1197.   exit 0
  1198. }
  1199.  
  1200. #=============
  1201. # CVP routine.
  1202. #=============
  1203. function MainStatusCVP
  1204. {
  1205.         print "\t\tCurrent System Configuration : "
  1206.         print
  1207.         print "\t\tInstalled :\tAlready installed on the system"
  1208.         print "\t\tNone:\t\tNot found on the system"
  1209.         print
  1210.     print "\t\tInterScan VirusWall Base System\t ${DASH} [ ${BOLD}${ISBASE}${UNBOLD}\t]"
  1211.         if [ "$ISBASE" = "Installed" ] ; then
  1212.            BASEPATH=`cat /etc/iscan/pkg/ISBASE`
  1213.            print "\t\tInstallation Path\t${BOLD}${BASEPATH}${UNBOLD}"
  1214.         fi
  1215.         print
  1216.         print "\t\tInterScan VirusWall CGI Admin\t ${DASH} [ ${BOLD}${ISADMIN}${UNBOLD}\t]"
  1217.         if [ "$ISADMIN" = "Installed" ] ; then
  1218.            ADMINPATH=`cat /etc/iscan/pkg/ISADMIN`
  1219.            print "\t\tInstallation Path\t${BOLD}${ADMINPATH}${UNBOLD}"
  1220.         fi
  1221.         print
  1222.         if [ "$ISCVP" = "Installed"  ] ; then
  1223.            CVPPATH=`cat /etc/iscan/pkg/ISCVP`
  1224.            if [ -s $CVPPATH/IScan.CVP/iscvp.trial ] ; then
  1225.                 ISCVPTRIAL=1
  1226.                 print "\t\tInterScan VirusWall Trial for CVP ${DASH} [ ${BOLD}${ISCVP}${UNBOLD}]"
  1227.            else
  1228.                 print "\t\tInterScan VirusWall for CVP\t ${DASH} [ ${BOLD}${ISCVP}${UNBOLD}]"
  1229.            fi
  1230.            print "\t\tInstallation Path\t${BOLD}${CVPPATH}${UNBOLD}"
  1231.         else
  1232.            print "\t\tInterScan VirusWall for CVP\t ${DASH} [ ${BOLD}${ISCVP}${UNBOLD}\t]"
  1233.         fi
  1234.         print
  1235.         if [ "$ISTVCS" = "Installed"  ] ; then
  1236.            TVCSPATH=`cat /etc/iscan/pkg/ISTVCS`
  1237.            print "\t\tInterScan VirusWall for TVCS\t ${DASH} [ ${BOLD}${ISTVCS}${UNBOLD}\t]"
  1238.            print "\t\tInstallation Path\t${BOLD}${TVCSPATH}${UNBOLD}"
  1239.         else
  1240.            print "\t\tInterScan VirusWall for TVCS\t ${DASH} [ ${BOLD}${ISTVCS}${UNBOLD}\t]"
  1241.         fi
  1242.         print
  1243. }
  1244.  
  1245. function DisplayInstallationOptions
  1246. {
  1247.   print "\t===============  INSTALLATION OPTIONS  =================="
  1248.   print
  1249.  
  1250.   case $1 in
  1251.  
  1252.   #=============#
  1253.   # BASE System #
  1254.   #=============#
  1255.   "BASE" )
  1256.     print "\tInstall Trend FileScan for Linux Base System\t ${DASH} [ ${BOLD}${INSTBASE}${UNBOLD} ]"
  1257.     print "\tBase install path\t${BOLD}${BASEPATH}${UNBOLD}" ;;
  1258.  
  1259.   #==============#
  1260.   # ADMIN System #
  1261.   #==============#
  1262.   "ADMIN" )
  1263.     print "\tInstall Trend FileScan for Linux Admn System\t ${DASH} [ ${BOLD}${INSTADMIN}${UNBOLD} ]"
  1264.     print "\tAdmin install path\t${BOLD}${ADMINPATH}${UNBOLD}" ;;
  1265.  
  1266.   #============#
  1267.   # ALL System #
  1268.   #============#
  1269.   "ALL" )
  1270.     print "\tInstall Trend FileScan for Linux Base System\t ${DASH} [ ${BOLD}${INSTBASE}${UNBOLD} ]"
  1271.     print "\t   Base install path\t${BOLD}${BASEPATH}${UNBOLD}"
  1272.     print "\tInstall Trend FileScan for Linux Admn System\t ${DASH} [ ${BOLD}${INSTADMIN}${UNBOLD} ]"
  1273.     print "\t   Admin install path\t${BOLD}${ADMINPATH}${UNBOLD}"
  1274.   esac
  1275.   print "\t========================================================="
  1276. }
  1277.  
  1278. #=============================================================
  1279. # DisplayCurrentConfig displays the status of InterScan packages 
  1280. # that are currently installed. For the installed packages, it 
  1281. # will also display the installation path.
  1282. #=============================================================
  1283. function DisplayCurrentConfig
  1284. {
  1285.   # should not need to scan installed packages again
  1286.   # however, do it just in case some of the globals
  1287.   # are incorrect
  1288.   ScanInstalledPackages
  1289.   ScanTrialPackages
  1290.  
  1291.   print "\t========================================================="
  1292.     
  1293.   #=============#
  1294.   # BASE System #
  1295.   #=============#    
  1296.   print "\tTrend FileScan for Linux Base System\t\t[ ${BOLD}${ISBASE}${UNBOLD}\t]"
  1297.   if [ "$ISBASE" = "Installed" ] ; then
  1298.     BASEPATH=`cat /etc/iscan/pkg/ISBASE`
  1299.     print "\t    Installation Path\t${BOLD}${BASEPATH}${UNBOLD}"
  1300.   fi
  1301.  
  1302.   #==============#
  1303.   # ADMIN System #
  1304.   #==============#
  1305.   print "\tTrend FileScan for Linux CGI Admin\t\t[ ${BOLD}${ISADMIN}${UNBOLD}\t]"
  1306.   if [ "$ISADMIN" = "Installed" ] ; then
  1307.     ADMINPATH=`cat /etc/iscan/pkg/ISADMIN`
  1308.     print "\t    Installation Path\t${BOLD}${ADMINPATH}${UNBOLD}"
  1309.   fi
  1310.  
  1311.   print "\t========================================================="
  1312. }
  1313.  
  1314. #====================================================================
  1315. # CheckForInstalledCVP checks to see if CVP is installed. If it is installed,
  1316. # CheckForInstalledCVP gives the user the opportunity to remove CVP.
  1317. # NOTE: CVP must be removed before VirusWall can be installed.
  1318. #====================================================================
  1319. function CheckForInstalledCVP
  1320. {
  1321.   # Check if allready installed CVP and remove all of then
  1322.   clear
  1323.   CheckSW "ISCVP"
  1324.   Header 
  1325.   if [ "$ISCVP" = "Installed" ] ; then 
  1326.     print $BOLD
  1327.     if [ "$ISCVPTRIAL" = "1" ] ; then 
  1328.       print "\t\tYou are currently running CVP Trial Version." 
  1329.     else 
  1330.       print "\t\tYou are currently running InterScan for CVP."
  1331.     fi 
  1332.     print "\t\tPlease remove it before installing this version."
  1333.     print $UNBOLD
  1334.     print -n "\tDo you want to remove it now? > " ; read RESP
  1335.     ChkResp $RESP "NO"
  1336.     if [ "$RESP" = "YES" ] ; then
  1337.       StartRemove "CVP" 
  1338.     else
  1339.       Main  
  1340.     fi
  1341.   fi
  1342. }
  1343.  
  1344. #================================================
  1345. # MainMenu presents the user with the main menu.
  1346. # NOTE: for non-CVS only.
  1347. #================================================
  1348. function MainMenu
  1349. {
  1350.   typeset done=false
  1351.  
  1352.   # CVP must be removed prior to VirusWall
  1353.   # installation
  1354.   CheckForInstalledCVP
  1355.  
  1356.   while [ $done = false ] ; do
  1357.     done=true 
  1358.   #  DisplayCurrentConfig
  1359.     print
  1360.     print "\tMain Menu"
  1361.     print
  1362.     print "\t1.\tInstall Trend FileScan for Linux sub-system."
  1363.     print "\t2.\tRemove Trend FileScan for Linux sub-system."
  1364.     print "\t3.\tConfigure Trend FileScan for Linux via web browser."
  1365.     print "\t\tThis option will terminate the installation."
  1366.  
  1367.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  1368.       print "\t4.\tExit."
  1369.     elif [ "$INSTALLTYPE" = "AddPkg" ] ; then
  1370.       print "\t4.\tReturn to the previous menu."
  1371.       print "\t5.\tExit."
  1372.     fi
  1373.  
  1374.     print 
  1375.     print -n "\t\tSelect a number > "
  1376.     read RESP
  1377.  
  1378.     if [ "$INSTALLTYPE" = "Tar" ] ; then
  1379.       case $RESP in
  1380.       1 ) Install
  1381.           done=false ;;
  1382.       2 ) Remove ;;
  1383.       3 ) ConfigIScanUsingBrowser
  1384.           done=false ;;
  1385.       4 ) Exit ;;
  1386.       * ) print "${BELL}\t\tInvalid choice. Please try again."
  1387.           PressAnyKey
  1388.           done=false ;;
  1389.       esac
  1390.     elif [ "$INSTALLTYPE" = "AddPkg" ] ; then
  1391.       case $RESP in
  1392.       1 ) Install
  1393.           done=false ;;
  1394.       2 ) Remove ;;
  1395.       3 ) ConfigIScanUsingBrowser
  1396.           done=false ;;
  1397.       4 ) Main ;;
  1398.       5 ) Exit ;;
  1399.       * ) print "${BELL}\t\tInvalid choice. Please try again."
  1400.           PressAnyKey
  1401.           done=false ;;
  1402.       esac
  1403.     fi
  1404.   done
  1405. }
  1406.  
  1407. #=============================================================
  1408. # ChkPkg checks to see if the packages needed for installation
  1409. # are found in the current directory. Knowing which tgz files
  1410. # are available, it sets some default options of what to 
  1411. # install and what not to install.
  1412. #=============================================================
  1413. function ChkPkg
  1414. {
  1415.   if [ -a ./$BASEPKG ] ; then
  1416.     INSTBASE="YES"
  1417.   fi
  1418.   if [ -a ./$ADMINPKG ] ; then
  1419.     INSTADMIN="YES"
  1420.   fi
  1421.   if [ -a ./$FTPPKG ] ; then
  1422.     INSTFTP="YES"
  1423.   fi
  1424.   if [ -a ./$SMTPPKG ] ; then
  1425.     INSTSMTP="YES"
  1426.   fi
  1427.   if [ -a ./$HTTPPKG ] ; then
  1428.     INSTHTTP="YES"
  1429.   fi
  1430.   if [ -a ./$TVCSPKG ] ; then
  1431.     #Force INSTTVCS=NO
  1432.     INSTTVCS="NO"
  1433.   fi
  1434.   if [ -a ./$CVPPKG ] ; then 
  1435.     INSTCVP="YES"
  1436.   fi
  1437. }
  1438.  
  1439. #==========
  1440. # Not used.
  1441. #==========
  1442. function PVCCINFO
  1443. {
  1444.         clear
  1445.         print ; print ;
  1446.     print "Trend VCS Information:\n" ; 
  1447.         print  "\t1. InterScan host :[$host]";
  1448.     print ;
  1449.         print  "\t2. IP address of the InterScan machine:[$ipaddr]";
  1450.     print ;
  1451.         print  "\t3. Site name: [$LO]." ;
  1452.     print ;
  1453.         print  "\t4. IP address of the Trend VCS server: [$VCC]." ;
  1454.     print ;
  1455. }
  1456.  
  1457. #==========
  1458. # Not used.
  1459. #==========
  1460. function VCCINFOCHANGE
  1461. {
  1462.  
  1463.         PVCCINFO
  1464.         print -n "  Specify the item number to modify or press Enter to accept:> ";read infnum
  1465.             case $infnum in
  1466.         1 ) print -n "\tInterScan host:> " ; read host;;
  1467.     2 ) print -n "\tIP address of the InterScan machine:> "; read ipaddr ;;
  1468.     3 ) print -n "\t Site name:> " ; read LO ;;
  1469.     4 )print -n "\tIP address of the Trend VCS server:> "; read VCC ;;
  1470.     * ) print ;;
  1471.         esac
  1472.     PressAnyKey
  1473.     return
  1474.  
  1475. }
  1476.  
  1477. #==========
  1478. # Not used.
  1479. #==========
  1480. function VCCINFO
  1481. {
  1482.     print ; print 
  1483.         host=`hostname`;
  1484.         ipaddr=`/etc/iscan/ip $host`;
  1485.         print -n "\tEnter the Trend VCS Site name for this server:> " ; read LO
  1486.         print -n "\tSpecify the IP address of the Trend VCS server:> " ; read VCC
  1487.     print -n "\t Trend VCS Information:\n" ;
  1488.         PVCCINFO
  1489.         print -n "\tCorrect?> " ; read RESP
  1490.         ChkResp $RESP ""
  1491. }
  1492.  
  1493. #==========
  1494. # Not used.
  1495. #==========
  1496. function DoRegister
  1497. {
  1498.         rg=`/opt/ISADMIN/IScan.adm/cgi-bin/Register /etc/iscan/solar.tmp` ;
  1499.         if [ $? -eq 1 ] ; then
  1500.         cat /etc/iscan/solar.tmp >>/etc/iscan/intscan.ini;
  1501.         rm /etc/iscan/solar.tmp
  1502.                 echo "Registration successful."
  1503.         /etc/rc.d/init.d/iscantvcsagt start > /dev/null
  1504.         else
  1505.                 sed -e 's/VccServer=*.*.*.*/VccServer=0/' < /etc/iscan/intscan.ini > /tmp/solar ;
  1506.     \cp /tmp/solar /etc/iscan/intscan.ini ;
  1507.                 echo "Unable to register with the Trend VCS server."
  1508.         echo "Please check the IP address specified (and network connection) then try again." 
  1509.         fi
  1510.         PressAnyKey
  1511.         return
  1512. }
  1513.  
  1514. #==========
  1515. # Not used.
  1516. #==========
  1517. function VCCRegister
  1518. {
  1519.     clear
  1520.         if [ -s /etc/iscan/ip ] ; then
  1521.                 VCCINFO
  1522.           while (true) ; do
  1523.                 if [ "$RESP" = "YES" ] ; then
  1524.                         break;
  1525.                 else
  1526.                         clear
  1527.                         VCCINFOCHANGE
  1528.                         PVCCINFO
  1529.                         print -n "\tCorrect? (Enter y/Y to accept, n/N to reject)> " ; read RESP
  1530.                         ChkResp $RESP ""
  1531.                 fi
  1532.           done
  1533.                 LO=$(print $LO | tr ' ' '_')
  1534.                 grep "TVCS" /etc/iscan/intscan.ini > /dev/null 2>&1;
  1535.                 if [ $? -ne 0 ] ; then
  1536.             sed -e 's/VccServer=0[ ]*/VccServer='$VCC'/;s/Location=0[ ]*/Location='$LO'/;s/Server=0[ ]*/Server='$host'/;s/ServerIP=0[ ]*/ServerIP='$ipaddr'/' < /etc/iscan/solar.ini > /etc/iscan/solar.tmp;
  1537.                         DoRegister
  1538.                 else
  1539.                         rc=`grep "VccServer=0" /etc/iscan/intscan.ini`;
  1540.                         if [ $? -ne 0 ] ;then
  1541.  
  1542.                            print "Registration already done!"
  1543.                            exit 1 ;
  1544.                         else
  1545.                                 sed -e 's/VccServer=0[ ]*/VccServer='$VCC'/' < /etc/iscan/intscan.ini > /tmp/solar ;
  1546.                                 \cp /tmp/solar /etc/iscan/intscan.ini;
  1547.                                 DoRegister
  1548.                         fi
  1549.  
  1550.                 fi
  1551.         else
  1552.                 print ${BOLD}
  1553.                 print -n "\t\tEnter a 1 to install Trend VCS."
  1554.                 print ${UNBOLD}
  1555.         PressAnyKey
  1556.                 return
  1557.         fi
  1558.         return
  1559. }
  1560.  
  1561. #=============
  1562. # CVP routine.
  1563. #=============
  1564. function InstallCVPOnly
  1565. {
  1566.         # start install cvp pkg and check the licence
  1567.      if [ "$INSTCVP" = "YES" ] ; then 
  1568.         # check cvp pkg
  1569.         if [ ! -s ./$CVPPKG ] ; then
  1570.                 print "\t\tCan not find InterScan CVP ($CVPPKG) in current directory." | fmt -70
  1571.                 PressAnyKey
  1572.                 return
  1573.         fi
  1574.         # check license program exist or not
  1575. #        if [ ! -s /etc/iscan/license ] ; then
  1576. #                        print -n " Can not find your license check program"
  1577. #                        PressAnyKey
  1578. #                        return
  1579. #        fi
  1580.  
  1581.         Header
  1582. #        print -n "\tEnter your serial number for InterScan VirusWall CVP : "
  1583. #        print -n ${BOLD}
  1584. #        /etc/iscan/license CVP
  1585.         # change pkg into trail version if serial number not match
  1586.         if [ "$LICENSE" != "OK" ] ; then
  1587.                 print -n "\tDo you want to install InterScan VirusWall Trial version for CVP? > " ; read RESP
  1588.                 ChkResp $RESP "NO"
  1589.                 if [ $RESP = "YES" ] ; then
  1590.                         TRIAL="YES"
  1591.                         CVPPKG="iscvp.evl"
  1592.                 else
  1593. #                        print -n ${UNBOLD}
  1594.                         return
  1595.                 fi
  1596.         fi
  1597. #        print -n ${UNBOLD}
  1598.  
  1599.         # begin to install CVP
  1600.         (cd /tmp ; mkdir pkgcvp )
  1601.         /bin/zcat < ./$CVPPKG | (cd /tmp/pkgcvp ; tar xf - )
  1602.         pkgadd -d /tmp/pkgcvp -R "$CVPPATH" ISCVP
  1603.         if [ $? -ne 0 ] ; then
  1604.                 echo $ERROR_LINE >> /usr/tmp/iscan_install_log
  1605.                 rm -rf $CVPPATH
  1606.         else
  1607.                 ISCVP="Installed"
  1608.         fi
  1609.         PressAnyKey
  1610.         rm -rf /tmp/pkgcvp
  1611.         INSTCVP="NO"
  1612.       fi 
  1613.  
  1614. #==================================================
  1615. # InstallTVCSOnly handles the installation of TVCS.
  1616. # NOTE: it looks like TVCS is only installed when
  1617. #       SMTP VirusWall is installed.
  1618. #==================================================
  1619. function InstallTVCSOnly
  1620. {
  1621.   if [ "$LICENSE" != "OK" ] ; then
  1622.     return
  1623.   fi
  1624.  
  1625.         if [ "$INSTTVCS" = "YES" && "$ISTVCS" = "Installed" ] ; then
  1626.                 print "\t\t${BOLD}InterScan TVCS has been installed in your system${UNBOLD}"
  1627.         PressAnyKey
  1628.                 INSTTVCS="NO"
  1629.         fi
  1630.  
  1631. if [ "$INSTTVCS" = "YES" ] ; then
  1632.                 if [ ! -s ./$TVCSPKG ] ; then
  1633.                         print "\t\tCan not find InterScan TVCS ($TVCSPKG ) in current directory." | fmt -70
  1634.                         PressAnyKey
  1635.                         return
  1636.                 fi
  1637.                 ( cd /tmp ; mkdir pkgtvcs )
  1638.                 /bin/zcat < ./$TVCSPKG | ( cd /tmp/pkgtvcs ; tar xf - )
  1639.                 pkgadd -d /tmp/pkgtvcs -R "$TVCSPATH" ISTVCS
  1640.         # append solar.ini to intscan.ini
  1641.         cat /etc/iscan/solar.ini >> /etc/iscan/intscan.ini
  1642.                 if [ $? -ne 0 ] ; then
  1643.                         echo $ERROR_LINE >> /usr/tmp/iscan_install_log
  1644.                         rm -rf $TVCSPATH
  1645.                 else
  1646.                 print
  1647.                 print "\tNote: Be sure to register this InterScan Agent"  
  1648.         print "\t      from the web configuration page."
  1649.         ISTVCS="Installed" 
  1650.         INSTTVCS="NO" 
  1651.                 fi
  1652.                 print
  1653.                 PressAnyKey
  1654.                 rm -rf /tmp/pkgtvcs
  1655.         fi
  1656. }
  1657.  
  1658. #========================================================
  1659. # InstallADMOnly handles the installation of ADM package.
  1660. #========================================================
  1661. function InstallADMOnly 
  1662. {
  1663.  
  1664. if [ "$INSTADMIN" = "YES" && "$ISADMIN" = "Installed" ] ; then
  1665.     print "\t\t${BOLD}InterScan ADMIN has been installed in your system${UNBOLD}"
  1666.                 PressAnyKey
  1667.                 INSTADMIN="NO"
  1668. fi
  1669.       #    print "\t\t${BOLD}Start Install IScan Admin...!${UNBOLD}\n" 
  1670.  
  1671.     if [ "$INSTADMIN" = "YES" ] ; then
  1672.                 if [ ! -s ./$ADMINPKG ] ; then
  1673.                         print "\t\tCan not find Trend FileScan for Linux Admin ($ADMINPKG) in current directory." | fmt -70
  1674.                         PressAnyKey
  1675.                         return
  1676.                 fi
  1677.                 ( cd /tmp ; mkdir pkgadmin )
  1678.                 /bin/zcat < ./$ADMINPKG | ( cd /tmp/pkgadmin ; tar xf - )
  1679.                 pkgadd -d /tmp/pkgadmin -R "$ADMINPATH" ISADMIN
  1680.                 if [ $? -ne 0 ] ; then
  1681.                         echo $ERROR_LINE >> /usr/tmp/iscan_install_log
  1682.                         rm -rf $ADMINPATH
  1683.         else
  1684.             ISADMIN="Installed" 
  1685.             
  1686.                 fi
  1687.                 PressAnyKey
  1688.                 rm -rf /tmp/pkgadmin
  1689.                 INSTADMIN="NO"
  1690.         fi
  1691.  
  1692. #==========================================================
  1693. # InstallBASEOnly handles the installation of BASE package.
  1694. # NOTE: This function is not called anywhere. Perhaps the
  1695. #       other routines that do a BASE installation can
  1696. #       simply call this routine. Makes for easier
  1697. #       maintenance.
  1698. #==========================================================
  1699. function InstallBASEOnly
  1700. {
  1701.      if [ "$INSTBASE" = "YES" ] ; then
  1702.     if [ ! -s ./$BASEPKG ] ; then
  1703.                 print "\t\tCan not find your Trend FileScan for Linux Base system  software ( $BASEPKG ) in current directory." | fmt -70
  1704.                 PressAnyKey
  1705.                 return
  1706.         fi
  1707.  
  1708.           # start install base pkg
  1709.           (cd /tmp ; mkdir pkgbase )
  1710.           /bin/zcat < ./$BASEPKG | (cd /tmp/pkgbase ; tar xf - )
  1711.           pkgadd -d /tmp/pkgbase -R "$BASEPATH" ISBASE
  1712.           if [ $? -ne 0 ] ; then
  1713.                 echo $ERROR_LINE >> /usr/tmp/iscan_install_log
  1714.                 rm -rf $BASEPATH
  1715.           else
  1716.                 ISBASE=Installed
  1717.           fi
  1718.                 PressAnyKey
  1719.                 rm -rf /tmp/pkgbase
  1720.                 INSTBASE="NO"
  1721.          # checking admin pkg
  1722.          if [ ! -s ./$ADMINPKG ] ; then
  1723.                 print "\t\tCan not find Trend FileScan for Linux Admin ( iscanhtp.tz ) in current d
  1724. irectory." | fmt -70
  1725.                 PressAnyKey
  1726.                 return
  1727.          fi
  1728.     fi
  1729. }
  1730.     
  1731. #=============
  1732. # CVP routine.
  1733. #=============
  1734. function StartInstallCVP
  1735. {
  1736.     # if install CVP do the following command.
  1737.         # Check if ADMIN pkg installed
  1738.         if [ "$ISADMIN" != "Installed" && "$INSTADMIN" != "YES" ] ; then
  1739.                 print "${BOLD}"
  1740.                 print "\t\tYou have to install Trend FileScan for Linux Virus ADMIN system."
  1741.                 print "${UNBOLD}"
  1742.                 PressAnyKey
  1743.                 return
  1744.         fi
  1745.     if [ $ISBASE != "Installed" ] ; then 
  1746.         InstallBASEOnly 
  1747.         InstallADMOnly
  1748.         InstallCVPOnly
  1749.         InstallTVCSOnly    
  1750.  
  1751.  
  1752.     else 
  1753.             ## Install ADM PKG
  1754.            #    InstallADMOnly
  1755.     # start install cvp pkg and check the licence
  1756.     # check cvp pkg
  1757.  
  1758.     if [ "$INSTCVP" = "YES" ] ; then 
  1759.                 if [ "$ISCVPTRIAL" = "1" ] ; then
  1760.                         Header
  1761.                         print ${BOLD}
  1762.                       print "\tYou are currently running CVP Trial Version.\n"
  1763.             print ${UNBOLD}
  1764.                         print -n "\tDo you want to re-install InterScan VirusWall for CVP? > " ; read RESP
  1765.                         ChkResp $RESP "NO"
  1766.                         if [ "$RESP" = "YES" ] ; then
  1767.                                 print -n "Removing the TRIAL VERSION."
  1768.                                # pkgrm -R `cat /etc/iscan/pkg/ISCVP` ISCVP
  1769.                 StartRemove "CVP" 
  1770.                                 CVPPKG="iscvp.tz"
  1771.                         else
  1772.                               #  print -n ${UNBOLD}
  1773.                 INSTCVP="NO" 
  1774.                                 return
  1775.                         fi
  1776.                         ISCVPTRIAL=0
  1777.             InstallADMOnly
  1778.             InstallCVPOnly 
  1779.             InstallTVCSOnly  
  1780.             return 
  1781.                 fi
  1782.  
  1783.         ## if CVP (but not trial version )already installed
  1784.            if [ "$ISCVP" = "Installed" ] ; then     
  1785.         clear
  1786.         Header
  1787.         print ${BOLD} 
  1788.           print -n "\t\tYou are currently running InterScan for CVP.\n"
  1789.            print -n "\t\tPlease remove it before installing this version.\n"
  1790.         print ${UNBOLD} 
  1791.           print -n "\t\tDo you want to remove it now? > " ; read RESP 
  1792.           ChkResp $RESP "NO"
  1793.               if  [ "$RESP" = "YES" ] ; then 
  1794.                   StartRemove "CVP" 
  1795.                 InstallADMOnly 
  1796.                 InstallCVPOnly
  1797.                 InstallTVCSOnly 
  1798.                 return 
  1799.             else
  1800.                 INSTCVP="NO" 
  1801.                 return
  1802.             fi 
  1803.            fi 
  1804.         
  1805.         ## If there is Old Base and Admin exist.
  1806.       if [ "$ISFTP" = "Installed" || "$ISSMTP" = "Installed" || "$ISHTTP" = "Installed" ] ; then
  1807.              print ${BOLD} 
  1808.              print -n "\tIf you are running InterScan VirusWall version 2.53 or earlier, \n"
  1809.              print -n "\tyou must remove ALL packages before installing the CVP version.\n"
  1810.          print -n "\tDo you want to do this now?\n" 
  1811.          print
  1812.          print -n "\t\tyes -- remove all packages \n"
  1813.          print -n "\t\tno -- remove smtp, http, ftp only\n"
  1814.          print -n "\t\tquit \n" 
  1815.          print ${UNBOLD}
  1816.          print -n "\tDo you want to remove all the packages?> " ; read RESP
  1817.     ChkResp $RESP "NO"
  1818.         if [ "$RESP" = "YES" ] ; then
  1819.             ### If ISTVCS already installed than reinstalled after remove
  1820.                 ## All the package
  1821.                           if [ "$ISTVCS" = "Installed" ] ; then
  1822.                                 INSTTVCS="YES"
  1823.                     fi
  1824.             RemoveAll    
  1825.             clear
  1826.             #    print -n "\tStarting CVP installation ...\n" 
  1827.             print 
  1828.             StartInstallCVP  
  1829.             return 
  1830.         fi
  1831.         if [ "$RESP" = "NO" ]  ; then     
  1832.           # keep the base and admin. 
  1833.             if [ "$ISFTP" = "Installed" ] ; then
  1834.                             StartRemove "FTP"
  1835.                     fi
  1836.                     if [ "$ISHTTP" = "Installed" ] ; then
  1837.                         StartRemove "HTTP"
  1838.                     fi
  1839.                     if [ "$ISSMTP" = "Installed" ] ; then
  1840.                         StartRemove "SMTP"
  1841.                 fi
  1842.               InstallADMOnly 
  1843.                   InstallCVPOnly  
  1844.               InstallTVCSOnly 
  1845.               return 
  1846.         fi
  1847.          if [ "$RESP" = "QUIT" ] ; then     
  1848.               return 
  1849.                  
  1850.         fi
  1851.        else 
  1852.         ### Ther is no Other InterScan viruswall installed 
  1853.               InstallADMOnly
  1854.               InstallCVPOnly   
  1855.               InstallTVCSOnly 
  1856.               return 
  1857.        fi
  1858.      fi 
  1859.               InstallADMOnly   
  1860.               InstallTVCSOnly
  1861.  
  1862. fi
  1863.  
  1864. }
  1865.  
  1866. #=============
  1867. # CVP routine.
  1868. #=============
  1869. function MainMenuCVP
  1870. {
  1871.         typeset done=false
  1872.  
  1873.     INSTALLCVP="YES"
  1874.  
  1875.         while [ $done = false ] ; do
  1876.         done=true
  1877.         {
  1878.  
  1879.          Header
  1880.          print "\t\tMain Menu"
  1881.          print
  1882.      MainStatusCVP 
  1883.          print "\t1.\tInstall InterScan CVP sub-system."
  1884.          print
  1885.          print "\t2.\tRemove InterScan CVP sub-system."
  1886.          print
  1887.        #  print "\t3.\tRegister InterScan with a Trend VCS server."
  1888.        #  print
  1889.      print "\t3.\tConfigure InterScan CVP via web browser (exit Setup)."
  1890.      print
  1891.      print "\t4.\tBack to the First Page."
  1892.      print
  1893.      print "\t5.\tExit."
  1894.     } >&2
  1895.     print ; print
  1896.         print -n " \tSelect a number > ";read RESP 
  1897.     case $RESP in
  1898.         1 ) InstallCVP ;;
  1899.         2 ) RemoveCVP ;; 
  1900.       #    3 ) VCCRegister ; done=false ;; 
  1901.     3 ) ConfigIScanUsingBrowser ; done=false;;
  1902.     4 ) Main ; done=false;;
  1903.     5 ) Exit ;;
  1904.     * ) print "\t\tAn invalid choice was entered. Please try again."
  1905.             done=false ;;
  1906.         esac
  1907.  
  1908.         done
  1909. }
  1910.  
  1911. #============
  1912. # CVP routine
  1913. #============
  1914. function InstallCVP
  1915. {
  1916.         while ( true ); do
  1917.         Header
  1918.         print
  1919.     print "\t\tInstall InterScan VirusWall Base System\t${DASH}\t[ ${BOLD}${INSTBASE}${UNBOLD}\t]"
  1920.         print "\t\tInstallation Path\t${BOLD}${BASEPATH}${UNBOLD}"
  1921.         print
  1922.     print "\t\tInstall InterScan VirusWall CGI Admin\t${DASH}\t[ ${BOLD}${INSTADMIN}${UNBOLD}\t]"
  1923.     print "\t\tInstallation Path\t${BOLD}${ADMINPATH}${UNBOLD}"
  1924.         print
  1925.         print "\t\tInstall InterScan VirusWall CVP System\t${DASH}\t[ ${BOLD}${INSTCVP}${UNBOLD}\t]"
  1926.         print "\t\tInstallation Path\t${BOLD}${CVPPATH}${UNBOLD}"
  1927.     print
  1928.         print "\t\tInstall InterScan VirusWall for TVCS\t${DASH}\t[ ${BOLD}${INSTTVCS}${UNBOLD}\t]"
  1929.         print "\t\tInstallation Path\t${BOLD}${TVCSPATH}${UNBOLD}"
  1930.         print
  1931.     {
  1932.     print "\t1.\tModify option for InterScan VirusWall for BASE."
  1933.         print "\t2.\tModify option for InterScan VirusWall for ADMIN."
  1934.         print "\t3.\tModify option for InterScan VirusWall for CVP. "
  1935.     print "\t4.\tModify option for InterScan VirusWall for TVCS."
  1936.      print "\t5.\tStart installation."
  1937.         print "\t6.\tBack to Main Menu."
  1938.     } >&2    
  1939.     print
  1940.         print -n "              Select a number > " ; read RESP
  1941.     case $RESP in
  1942.     1 ) Modify BASE ;;
  1943.         2 ) Modify ADMIN ;;
  1944.         3 ) Modify CVP ;;
  1945.     4 ) Modify TVCS ;; 
  1946.     5 ) StartInstall ;;
  1947.     6 ) MainMenuCVP ;;
  1948.         * ) print "${BELL}\t\tAn invalid choice was entered. Please try again."
  1949.         esac
  1950.         done
  1951. }    
  1952.  
  1953. #====================================================================
  1954. # RemoveAll will remove all the InterScan packages that are installed
  1955. # on the system.
  1956. #====================================================================
  1957. function RemoveAll
  1958. {
  1959.   prn_msg=1
  1960.  
  1961.   if [ "$ISTVCS" = "Installed" ] ; then
  1962.     StartRemove "TVCS"
  1963.     prn_msg=0
  1964.   fi
  1965.   if [ "$ISFTP" = "Installed" ] ; then
  1966.     StartRemove "FTP"
  1967.     prn_msg=0
  1968.   fi
  1969.   if [ "$ISHTTP" = "Installed" ] ; then
  1970.     StartRemove "HTTP"
  1971.     prn_msg=0
  1972.   fi
  1973.   if [ "$ISSMTP" = "Installed" ] ; then
  1974.     StartRemove "SMTP"
  1975.     prn_msg=0
  1976.   fi
  1977.   if [ "$ISCVP" = "Installed" ] ; then
  1978.     StartRemove "CVP"
  1979.     prn_msg=0
  1980.   fi
  1981.   if [ "$ISADMIN" = "Installed" ] ; then
  1982.     StartRemove "ADMIN"
  1983.     prn_msg=0
  1984.   fi
  1985.   if [ "$ISBASE" = "Installed" ] ; then
  1986.     StartRemove "BASE"
  1987.     prn_msg=0
  1988.   fi
  1989.  
  1990.   if [ "$prn_msg" = 1 ] ; then
  1991.     print $BOLD
  1992.     print "\t\tInterScan VirusWall is not installed."
  1993.     print $UNBOLD
  1994.     PressAnyKey
  1995.   fi
  1996. }
  1997.  
  1998. #=========================================================
  1999. # Main presents the user with the initial menu of options.
  2000. #=========================================================
  2001. function Main
  2002. {
  2003.   typeset loop=true
  2004.     
  2005.   # clear the screen
  2006.   clear
  2007.  
  2008.   # check to see if the installation sources are in the
  2009.   # current directory
  2010.   ChkPkg
  2011.  
  2012.   # check to see which InterScan packages are already
  2013.   # installed in the system
  2014.   ScanInstalledPackages
  2015.   ScanTrialPackages
  2016.  
  2017.   if [ "$INSTALLTYPE" = "Tar" ] ; then
  2018.     INSTALLCVP="NO"
  2019.     MainMenu
  2020.   elif [ "$INSTALLTYPE" = "AddPkg" ] ; then
  2021.     while [ $loop = true ] ; do
  2022.       loop=false
  2023.       Header
  2024.       print
  2025.       print
  2026.       print "\t1.\tInterScan Viruswall for CVP."
  2027.       print "\t2.\tInterScan VirusWall for FTP, SMTP, HTTP."
  2028.       print "\t3.\tExit."
  2029.       print
  2030.       print -n "\t\tSelect an option > "
  2031.       read RESP
  2032.       case $RESP in
  2033.       1 ) INSTALLCVP="YES"
  2034.       MainMenuCVP ;; 
  2035.       2 ) INSTALLCVP="NO"
  2036.           MainMenu ;;
  2037.       3 ) Exit ;; 
  2038.       * ) print "${BELL}\t\tInvalid choice. Please try again."
  2039.         PressAnyKey
  2040.           loop=true ;; 
  2041.       esac
  2042.     done
  2043.   fi
  2044. }
  2045.  
  2046. #==================== BEGIN ROUTINES FOR TAR INSTALLATION ========================
  2047.  
  2048. function BaseInstallUsingTar
  2049. {
  2050.   # is the source in the current directory?
  2051.   if [ ! -s ./$BASEPKG ] ; then
  2052.     print "InterScan VirusWall Base system ($BASEPKG) not found in current directory." 
  2053.     return
  2054.   fi
  2055.  
  2056.   print "Start installation of Base system."
  2057.  
  2058.   # if the target path does not exists, create it
  2059.   if [ ! -d $BASEPATH ] ; then
  2060.     mkdir -p $BASEPATH
  2061.   fi
  2062.  
  2063.   # remove all files from support directory
  2064.   rm -rf /tmp/iscan_support
  2065.   mkdir /tmp/iscan_support
  2066.  
  2067.   # untar the package files
  2068.   /bin/zcat < ./$BASEPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null )
  2069.  
  2070.   # set file ownership and modes
  2071.   chown -R root /tmp/iscan_support/*
  2072.   chgrp -R sys /tmp/iscan_support/*
  2073.   chmod -R 555 /tmp/iscan_support/*
  2074.  
  2075.   # copy files to final destination
  2076.   \cp /tmp/iscan_support/* $BASEPATH
  2077.   \rm -rf /tmp/iscan_support
  2078.  
  2079.   #======================#
  2080.   # Postinstall for BASE #
  2081.   #======================#
  2082.  
  2083.   if [ -s /etc/iscan ] ; then
  2084.     rm -rf /etc/iscan/*
  2085.   else
  2086.     mkdir /etc/iscan
  2087.     mkdir /etc/iscan/virus
  2088.   fi
  2089.   chmod 0755 /etc/iscan
  2090.   chown root /etc/iscan
  2091.   chgrp bin /etc/iscan
  2092.  
  2093.   # create links from target area to /etc/iscan
  2094.   for i in ${BASEFILES} ; do
  2095.     cp ${BASEPATH}/$i /etc/iscan/$i
  2096.     \rm -f ${BASEPATH}/$i
  2097.   done
  2098.  
  2099.   chmod 644 /etc/iscan/intscan.ini
  2100.   chmod 444 /etc/iscan/intscan.ini.orig /etc/iscan/lpt* /etc/iscan/mac*
  2101.  
  2102.   # add 1 new cron jobs
  2103.   crontab -l > /tmp/istmp_cron 
  2104.   echo "0 * * * * /etc/iscan/prescan.cgi >/dev/null 2>&1" >> /tmp/istmp_cron
  2105.   crontab /tmp/istmp_cron 2>/dev/null
  2106.   rm /tmp/istmp_cron
  2107.  
  2108.   # record base installation directory in /etc/iscan/pkg/ISBASE
  2109.   mkdir /etc/iscan/pkg
  2110.   chmod 0755 /etc/iscan/pkg
  2111.   chown root /etc/iscan/pkg
  2112.   chgrp bin /etc/iscan/pkg
  2113.   echo $BASEPATH > /etc/iscan/pkg/ISBASE
  2114.  
  2115.   # user has selected to upgrade, then restore their .ini and .log files
  2116.   if [ "$UPGRADE" = "YES" ] ; then
  2117.     /etc/iscan/uplog /tmp/iscan_dir/iscan.log /etc/iscan/virus.log
  2118.     \cp /tmp/iscan_dir/intscan.ini /etc/iscan/intscan.ini
  2119.     /etc/iscan/upgrade /etc/iscan/intscan.ini
  2120.     mkdir /etc/iscan/obsolete_log_ini
  2121.     \cp /tmp/iscan_dir/* /etc/iscan/obsolete_log_ini
  2122.     rm -rf /tmp/iscan_dir
  2123.   fi
  2124.  
  2125.   ISBASE="Installed"
  2126.   INSTBASE="NO"
  2127.   print "Finishing installation of Base system."
  2128. }
  2129.  
  2130. function BaseRemoveUsingTar
  2131. {
  2132.   if [ -f /etc/iscan/pkg/ISBASE ] ; then
  2133.     BASEPATH=`cat /etc/iscan/pkg/ISBASE`
  2134.   else
  2135.     print $BOLD
  2136.     print "Cannot remove BASE; /etc/iscan/pkg/ISBASE not found."
  2137.     print $UNBOLD
  2138.     PressAnyKey
  2139.     return
  2140.   fi
  2141.  
  2142.   print "Start removal of Base system."
  2143.  
  2144.   # remove cron jobs (by removing all lines with cleanscan and prescan in them)
  2145.   /usr/bin/crontab -l | grep -v cleanscan | grep -v prescan > /tmp/iscron
  2146.   crontab /tmp/iscron 2>/dev/null
  2147.   rm -rf /tmp/iscron
  2148.   ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4`
  2149.   for ind in $ATID ; do
  2150.     atrm $ind
  2151.   done
  2152.   rm -rf /etc/iscan
  2153.  
  2154.   # remove installed files
  2155.   for i in ${BASEFILES} ; do
  2156.     rm -f $BASEPATH/$i
  2157.   done
  2158.  
  2159.   # now remove the base directory if it is empty
  2160.   rm -rf $BASEPATH
  2161.  
  2162.   # remove /opt/trend if it is empty
  2163.   rm -rf /opt/trend
  2164.       
  2165.   if [ ! -r /etc/iscan ] ; then
  2166.     ISBASE="None"
  2167.     INSTBASE="YES"
  2168.   fi
  2169.  
  2170.   print "Finish removal of Base system."
  2171. }
  2172.  
  2173. function AdminInstallUsingTar
  2174. {
  2175.   # is the source in the current directory?
  2176.   if [ ! -s ./$ADMINPKG ] ; then
  2177.     print "InterScan Admin system ($ADMINPKG) not found in current directory." 
  2178.     return
  2179.   fi
  2180.  
  2181.   # print message
  2182.   print "Start installation of Admin system."
  2183.  
  2184.   # if the target path does not exists, create it
  2185.   if [ ! -d $ADMINPATH ] ; then
  2186.     mkdir -p $ADMINPATH
  2187.   fi
  2188.  
  2189.   # remove all files from support directory
  2190.   rm -rf /tmp/iscan_support
  2191.   mkdir /tmp/iscan_support
  2192.  
  2193.   # untar the package files
  2194.   /bin/zcat < ./$ADMINPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null )
  2195.  
  2196.   # set file ownership and modes
  2197.   chown -R root /tmp/iscan_support/*
  2198.   chgrp -R bin /tmp/iscan_support/*
  2199.   chmod -R 555 /tmp/iscan_support/*
  2200.  
  2201.   # copy files to final destination
  2202.   \cp -r /tmp/iscan_support/* $ADMINPATH
  2203.   \rm -rf /tmp/iscan_support
  2204.  
  2205.   # replace xxxxxxxx with hostname.domainname in the httpd.conf
  2206.   if [ -s /bin/domainname ] ; then
  2207.     NAME=`/bin/hostname`
  2208.     sed -e 's/xxxxxxxx/'$NAME'/'  ${ADMINPATH}/config/httpd.conf > /tmp/pp$$
  2209.     \cp /tmp/pp$$ ${ADMINPATH}/config/httpd.conf
  2210.   fi
  2211.  
  2212.   # replace globally all / with \/
  2213.   echo $ADMINPATH | sed -e 's/\//\\\//g' > /tmp/tmpvar$$
  2214.  
  2215.   # TMPVAR has the same path as $ADMINPATH but with the /'s escaped
  2216.   TMPVAR=`cat /tmp/tmpvar$$` ; rm -f /tmp/tmpvar$$
  2217.  
  2218.   # replace all PKG_INSTALL_ROOT with the install path in $ADMINPATH
  2219.   sed -e 's/PKG_INSTALL_ROOT/'${TMPVAR}'/g'  ${ADMINPATH}/config/httpd.conf > /tmp/pp$$
  2220.   \cp /tmp/pp$$ ${ADMINPATH}/config/httpd.conf
  2221.   sed -e 's/PKG_INSTALL_ROOT/'${TMPVAR}'/g'  ${ADMINPATH}/bin/iscanhttpd  > /tmp/pp$$
  2222.   \cp /tmp/pp$$ /etc/rc.d/init.d/iscanhttpd
  2223.   chown root /etc/rc.d/init.d/iscanhttpd
  2224.   chgrp sys /etc/rc.d/init.d/iscanhttpd
  2225.   chmod 0755 /etc/rc.d/init.d/iscanhttpd
  2226.  
  2227.   ln -s /etc/rc.d/init.d/iscanhttpd /etc/rc.d/rc3.d/S999IScanHttpd
  2228.   ln -s /etc/rc.d/init.d/iscanhttpd /etc/rc.d/rc0.d/K999IScanHttpd
  2229.   ln -s /etc/rc.d/init.d/iscanhttpd /etc/rc.d/rc5.d/S999IScanHttpd
  2230.  
  2231.   # start the Web Configuration Server
  2232.   /etc/rc.d/init.d/iscanhttpd start > /dev/null
  2233.  
  2234.   ln -s ${ADMINPATH}/cgi-bin/gettxt /usr/bin/gettxt
  2235.   ln -s ${ADMINPATH}/config/.htpasswd /etc/iscan/.htpasswd
  2236.  
  2237.   # Add by Jessica link some cgi programs to /etc/iscan  
  2238.   for i in ${ADMINFILES} ; do
  2239.     ln -s ${ADMINPATH}/cgi-bin/$i /etc/iscan/$i
  2240.     chmod 544 /etc/iscan/$i
  2241.     chown bin /etc/iscan/$i
  2242.     chgrp bin /etc/iscan/$i
  2243.   done
  2244.   # link the group file to /etc/iscan
  2245.     ln -s ${ADMINPATH}/config/group /etc/iscan/.group
  2246.     chmod 544 /etc/iscan/.group
  2247.     chown root /etc/iscan/.group
  2248.     chown root /etc/iscan/.group
  2249.  
  2250.    # change mode 4755
  2251.         CGIFILES="proxy.set pscan.set scancfg.set update.set setpasswd.cgi\
  2252.  vlog purge.cgi scanning scannow.cgi getptn_net.cgi"
  2253.     for i in ${CGIFILES} ; do
  2254.         chmod 4755 ${ADMINPATH}/cgi-bin/$i
  2255.     done
  2256.  
  2257.  
  2258.   echo ${ADMINPATH} > /etc/iscan/pkg/ISADMIN
  2259.   rm /tmp/pp$$
  2260.  
  2261.   ISADMIN="Installed"
  2262.   INSTADMIN="NO"
  2263.   print "Finish installation of Admin system."
  2264. }
  2265.  
  2266. function AdminRemoveUsingTar
  2267. {
  2268.   if [ -f /etc/iscan/pkg/ISADMIN ] ; then
  2269.     ADMINPATH=`cat /etc/iscan/pkg/ISADMIN`
  2270.   else
  2271.     print $BOLD
  2272.     print "Cannot remove ADMIN; /etc/iscan/pkg/ISADMIN not found."
  2273.     print $UNBOLD
  2274.     PressAnyKey
  2275.     return
  2276.   fi
  2277.  
  2278.   print "Start removal of Admin system."
  2279.  
  2280.   /etc/rc.d/init.d/iscanhttpd stop 2> /dev/null
  2281.  
  2282.   rm -f /etc/iscan/*.html           \
  2283.         /etc/iscan/start.cgi        \
  2284.         /etc/iscan/shutdown.cgi     \
  2285.         /etc/iscan/daemonhup.sh     \
  2286.         /etc/iscan/isswitch.cgi     \
  2287.         /etc/iscan/.htpasswd        \
  2288.         /usr/bin/gettxt             \
  2289.         /etc/rc.d/rc0.d/K999IScanHttpd  \
  2290.         /etc/rc.d/rc3.d/S999IScanHttpd  \
  2291.     /etc/rc.d/rc5.d/S999IScanHttpd  \
  2292.         /etc/rc.d/init.d/iscanhttpd     \
  2293.         /etc/iscan/pkg/ISADMIN
  2294.  
  2295.   # remove the adm directories
  2296.   for i in ${ADMINDIRS} ; do 
  2297.     rm -rf $ADMINPATH/$i
  2298.   done
  2299.  
  2300.   # now remove the directory if it is empty
  2301.   FILES=`ls $ADMINPATH`
  2302.   for i in $FILES
  2303.   do
  2304.   if [ ! -n $i ] ; then
  2305.     rm -rf $ADMINPATH
  2306.   fi
  2307.   done
  2308.  
  2309.   rm -rf $ADMINFILES 
  2310.   ISADMIN="None"
  2311.   INSTADMIN="YES"
  2312.   print "Finish removal of Admin system."
  2313. }
  2314.  
  2315. function FTPInstallUsingTar
  2316. {
  2317.   if [ "$ISFTP" = "Installed" ] ; then
  2318.     if [ "$ISFTPTRIAL" = 1 -a "$LICENSE" = "OK" ] ; then
  2319.       print "You have installed TRIAL VERSION of ISFTP on the system."
  2320.       print -n "Do you want to upgrade to the full version of InterScan VirusWall for FTP? > "
  2321.       read RESP
  2322.       ChkResp $RESP "no"
  2323.       if [ "$RESP" = "YES" ] ; then
  2324.         StartRemove "FTP"
  2325.         FTPPKG="isftp.tz"
  2326.       else
  2327.         return
  2328.       fi
  2329.     elif [ "$LICENSE" = "OK" ] ; then
  2330.       print "Full version of InterScan VirusWall for FTP is already installed."
  2331.       print "To reinstall ISFTP, please remove the package first."
  2332.       return
  2333.     fi
  2334.   else
  2335.     if [ "$LICENSE" = "OK" ] ; then
  2336.       FTPPKG="isftp.tz"
  2337.     else
  2338.       print -n "Do you want to install the trial version for FTP? > "
  2339.       read RESP
  2340.       ChkResp $RESP "NO"
  2341.       if [ "$RESP" = "YES" ] ; then
  2342.         ISFTPTRIAL="YES"
  2343.         FTPPKG="isftp.evl"
  2344.       else
  2345.         return
  2346.       fi
  2347.     fi
  2348.   fi
  2349.  
  2350.   # is the source in the current directory?
  2351.   if [ ! -s ./$FTPPKG ] ; then
  2352.     print "InterScan FTP system ($FTPPKG) not found in current directory." 
  2353.     return
  2354.   fi
  2355.  
  2356.   print "Start installation of FTP system."
  2357.  
  2358.   # if the target path does not exist, create it
  2359.   if [ ! -d $FTPPATH ] ; then
  2360.     mkdir -p $FTPPATH
  2361.   fi
  2362.  
  2363.   # remove all files from support directory
  2364.   rm -rf /tmp/iscan_support
  2365.   mkdir /tmp/iscan_support
  2366.  
  2367.   # untar the package files
  2368.   /bin/zcat < ./$FTPPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null )
  2369.  
  2370.   # set file ownership and modes
  2371.   chown -R root /tmp/iscan_support/*
  2372.   chgrp -R bin /tmp/iscan_support/*
  2373.   chmod -R 555 /tmp/iscan_support/*
  2374.  
  2375.   # copy files to final destination
  2376.   \cp /tmp/iscan_support/* $FTPPATH
  2377.  
  2378.   if [ "$FTPPKG" = "isftp.evl" ] ; then
  2379.     FTP_ORIG=${FTPPATH}/isftpd.trial
  2380.   else
  2381.     FTP_ORIG=${FTPPATH}/isftpd
  2382.   fi
  2383.  
  2384.   rm -f /etc/iscan/isftpd
  2385. # LINUX BUG
  2386. # ln -s $FTP_ORIG /etc/iscan/isftpd
  2387.   cp $FTP_ORIG /etc/iscan/isftpd
  2388.   \rm -f $FTP_ORIG
  2389.   chmod 555 /etc/iscan/isftpd
  2390.   chown root /etc/iscan/isftpd
  2391.   chgrp sys /etc/iscan/isftpd
  2392.  
  2393.   ln -s ${FTPPATH}/iscanftp /etc/rc.d/init.d/iscanftp
  2394.   chmod 755 /etc/rc.d/init.d/iscanftp
  2395.   chown root /etc/rc.d/init.d/iscanftp
  2396.   chgrp sys /etc/rc.d/init.d/iscanftp
  2397.   rm -f /etc/rc.d/rc3.d/S991IScanFTP
  2398.   ln -s /etc/rc.d/init.d/iscanftp /etc/rc.d/rc3.d/S991IScanFTP
  2399.   rm -f /etc/rc.d/rc0.d/K991IScanFTP
  2400.   ln -s /etc/rc.d/init.d/iscanftp /etc/rc.d/rc0.d/K991IScanFTP
  2401.   INETD=/etc/inetd.conf
  2402.  
  2403.   # comment out the line in /etc/inetd.conf containing
  2404.   # "/usr/lbin/ftpd"
  2405.   status=`grep "^#" $INETD | grep "in.ftpd"`
  2406.   if [ $? -eq 0 ] ; then
  2407.         sed -e "/ftp/s/#    *//" $INETD > /tmp/tmp$$
  2408.     \mv /tmp/tmp$$ $INETD
  2409.   fi
  2410.  
  2411. ed $INETD <<EOF >/dev/null 2>/dev/null
  2412. /in.ftpd
  2413. s/\(.*\)/#    \1/
  2414. .
  2415. w
  2416. q
  2417. EOF
  2418.  
  2419.   # restart inetd
  2420.   INETDPID=`ps aux | grep '[^[]'inetd | grep -v grep | awk '{print $2}'`
  2421.   if [ "$INETDPID" ] ; then
  2422.     kill -HUP $INETDPID
  2423.     sleep 3
  2424.   fi
  2425.  
  2426.   echo ${FTPPATH} > /etc/iscan/pkg/ISFTP
  2427.   ISFTP="Installed"
  2428.   INSTFTP="NO"
  2429.   print "Finish installation of FTP system."
  2430. }
  2431.  
  2432. function FTPRemoveUsingTar
  2433. {
  2434.   if [ -f /etc/iscan/pkg/ISFTP ] ; then
  2435.     FTPPATH=`cat /etc/iscan/pkg/ISFTP`
  2436.   else
  2437.     print $BOLD
  2438.     print "Cannot remove FTP; /etc/iscan/pkg/ISFTP not found."
  2439.     print $UNBOLD
  2440.     PressAnyKey
  2441.     return
  2442.   fi
  2443.  
  2444.   print "Start removal of FTP system."
  2445.  
  2446.   # stop daemon
  2447.   /etc/rc.d/init.d/iscanftp stop 2>/dev/null >/dev/null
  2448.  
  2449.   status=`grep "^#" /etc/inetd.conf | grep "in.ftpd"`
  2450.   if [ "$status" != "" ] ; then
  2451.     sed -e "/in.ftpd/s/^#    //" /etc/inetd.conf > /tmp/tmp$$
  2452.     \mv /tmp/tmp$$ /etc/inetd.conf
  2453.   fi
  2454.  
  2455.   rm -f /etc/rc.d/init.d/iscanftp     \
  2456.         /etc/iscan/isftpd \
  2457.         /etc/rc.d/rc3.d/S991IScanFTP  \
  2458.         /etc/rc.d/rc0.d/K991IScanFTP  \
  2459.         /etc/iscan/pkg/ISFTP
  2460.  
  2461.   # kill the inetd process
  2462.  
  2463.   INETDPID=`ps x | grep inetd | grep -v grep | awk '{print $1}'`
  2464.   if [ "$INETDPID" != "" ] ; then
  2465.     kill -1 $INETDPID 2>/dev/null >/dev/null
  2466.   fi
  2467.  
  2468.   # remove the ftp file
  2469.   for i in ${FTPFILES} ; do
  2470.     rm -f $FTPPATH/$i
  2471.   done
  2472.  
  2473.   # now remove the directory if it is empty
  2474.   FILES=`ls $FTPPATH`
  2475.   if [ ! -n $FILES ] ; then
  2476.     rm -rf $FTPPATH
  2477.   fi
  2478.  
  2479.   ISFTP="None"
  2480.   INSTFTP="YES"
  2481.   print "Finish removal of FTP system."
  2482. }
  2483.  
  2484. function SMTPInstallUsingTar
  2485. {
  2486. #  loop=true
  2487. #  while [ $loop = true ] ; do
  2488. #    loop=false
  2489. #    print
  2490. #    print "\t1.\tInterScan Viruswall SMTP."
  2491. #    print "\t2.\tInterScan VirusWall Plugins for Sendmail."
  2492. #    print
  2493. #    print -n "\t\tSelect type of SMTP Viruswall to install > "
  2494. #    read RESP
  2495. #    case $RESP in
  2496. #    1 ) ISPORS="issmtp" ;;
  2497. #    2 ) ISPORS="isplug" ;; 
  2498. #    * ) print "${BELL}\t\tInvalid choice. Please try again."
  2499. #        loop=true ;;
  2500. #    esac
  2501. #  done
  2502. ISPORS="issmtp"
  2503.  
  2504.   if [ "$ISSMTP" = "Installed" ] ; then
  2505.     if [ "$ISSMTPTRIAL" = 1 -a "$LICENSE" = "OK" ] ; then
  2506.       print "You have installed TRIAL VERSION of ISSMTP on the system."
  2507.       print -n "Do you want to upgrade to the full version of InterScan VirusWall for SMTP? > "
  2508.       read RESP
  2509.       ChkResp $RESP "no"
  2510.       if [ "$RESP" = "YES" ] ; then
  2511.         StartRemove "SMTP"
  2512.         SMTPPKG="$ISPORS.tz"
  2513.       else
  2514.         return
  2515.       fi
  2516.     elif [ "$LICENSE" = "OK" ] ; then
  2517.       print "Full version of InterScan VirusWall for SMTP is already installed."
  2518.       print "To reinstall ISSMTP, please remove the package first."
  2519.       return
  2520.     fi
  2521.   else
  2522.     if [ "$LICENSE" = "OK" ] ; then
  2523.       SMTPPKG="$ISPORS.tz"
  2524.     else
  2525.       print -n "Do you want to install the trial version for SMTP? > "
  2526.       read RESP
  2527.       ChkResp $RESP "NO"
  2528.       if [ "$RESP" = "YES" ] ; then
  2529.         ISSMTPTRIAL="YES"
  2530.         SMTPPKG="$ISPORS.evl"
  2531.       else
  2532.         return
  2533.       fi
  2534.     fi
  2535.   fi
  2536.  
  2537.   # is the source in the current directory?
  2538.   if [ ! -a ./$SMTPPKG ] ; then
  2539.     print "InterScan SMTP system ($SMTPPKG) not found in current directory." 
  2540.     return
  2541.   fi
  2542.  
  2543.   print "Start installation of SMTP system."
  2544.  
  2545.   if [ "$ISPORS" = "isplug" ] ; then
  2546.     /etc/iscan/pluginst
  2547.     if [ "$?" != 0 ] ; then
  2548.       print "Installation of SMTP Plugins failed."
  2549.       print "Finish installation of SMTP system."
  2550.       return
  2551.     fi
  2552.   fi
  2553.  
  2554.   # if the target path does not exist, create it
  2555.   if [ ! -d $SMTPPATH ] ; then
  2556.     mkdir $SMTPPATH
  2557.   fi
  2558.  
  2559.   # remove all files from support directory
  2560.   rm -rf /tmp/iscan_support
  2561.   mkdir /tmp/iscan_support
  2562.  
  2563.   # untar the package files
  2564.   /bin/zcat < ./$SMTPPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null )
  2565.  
  2566.   # set file ownership and modes
  2567.   chown -R root /tmp/iscan_support/*
  2568.   chgrp -R sys /tmp/iscan_support/*
  2569.   chmod -R 555 /tmp/iscan_support/*
  2570.  
  2571.   # copy files to final destination
  2572.   \cp /tmp/iscan_support/* $SMTPPATH
  2573.  
  2574.   if [ "$ISPORS" = "isplug" ] ; then
  2575.  
  2576.     if [ "$SMTPPKG" = "isplug.evl" ] ; then
  2577.       ln -s $SMTPPATH/isfilter.trial /etc/iscan/isfilter
  2578.     else
  2579.       ln -s $SMTPPATH/isfilter /etc/iscan/isfilter
  2580.     fi
  2581.     chmod 555 /etc/iscan/isfilter
  2582.     chown root /etc/iscan/isfilter
  2583.     chgrp sys /etc/iscan/isfilter
  2584.     chmod +s /etc/iscan/isfilter
  2585.  
  2586.     # anti spamming in v3.0
  2587.     if [ ! -d /etc/iscan/Spamdb ] ; then
  2588.       mkdir -p /etc/iscan/Spamdb
  2589.       chmod 744 /etc/iscan/Spamdb
  2590.       chown root /etc/iscan/Spamdb
  2591.       chgrp root /etc/iscan/Spamdb
  2592.     fi
  2593.  
  2594.     # print SMTP plugins readme
  2595.     cat /etc/iscan/plugreadme
  2596.   else
  2597.     rm -f /etc/iscan/sendmail
  2598.     if [ "$SMTPPKG" = "issmtp.evl" ] ; then
  2599.       cp ${SMTPPATH}/issmtpd.trial /etc/iscan/sendmail
  2600.       \rm -f ${SMTPPATH}/issmtpd.trial 
  2601.     else
  2602.       cp ${SMTPPATH}/issmtpd /etc/iscan/sendmail
  2603.       \rm -f ${SMTPPATH}/issmtpd
  2604.     fi
  2605.     chmod 551 /etc/iscan/sendmail
  2606.     chown root /etc/iscan/sendmail
  2607.     chgrp sys /etc/iscan/sendmail
  2608.     \cp /etc/rc.d/init.d/sendmail /etc/iscan/sendmail.org
  2609.     rm -f /etc/rc.d/init.d/sendmail
  2610.     ln -s ${SMTPPATH}/iscansmtp /etc/rc.d/init.d/sendmail
  2611.     chmod 555 /etc/rc.d/init.d/sendmail 
  2612.     chown bin /etc/rc.d/init.d/sendmail
  2613.     chgrp bin /etc/rc.d/init.d/sendmail
  2614.   fi
  2615.  
  2616.   echo ${SMTPPATH} > /etc/iscan/pkg/ISSMTP
  2617.   ISSMTP="Installed"
  2618.   INSTSMTP="NO"
  2619.   print "Finish installation of SMTP system."
  2620. }
  2621.  
  2622. function SMTPRemoveUsingTar
  2623. {
  2624.   if [ -f /etc/iscan/pkg/ISSMTP ] ; then
  2625.     SMTPPATH=`cat /etc/iscan/pkg/ISSMTP`
  2626.   else
  2627.     print $BOLD
  2628.     print "Cannot remove SMTP; /etc/iscan/pkg/ISSMTP not found."
  2629.     print $UNBOLD
  2630.     PressAnyKey
  2631.     return
  2632.   fi
  2633.  
  2634.   print "Start removal of SMTP system."
  2635.  
  2636.   if [ -a /etc/iscan/isfilter ] ; then
  2637.     # stop sendmail daemon
  2638.     /etc/rc.d/init.d/sendmail stop > /dev/null
  2639.  
  2640.     # restore original sendmail.cf configuration file
  2641.     if [ -s /etc/iscan/sendmail.cf.org ] ; then
  2642.       \cp /etc/iscan/sendmail.cf.org /etc/sendmail.cf
  2643.     fi
  2644.  
  2645.     # restart daemon
  2646.     /etc/rc.d/init.d/sendmail start > /dev/null
  2647.  
  2648.     # remove links and files
  2649.     rm -f /etc/iscan/sendmail        \
  2650.           /etc/iscan/sendmail.cf.org \
  2651.           /etc/iscan/pkg/ISSMTP      \
  2652.           /etc/iscan/isfilter        \
  2653.           /etc/iscan/sendmail.cf.is \
  2654.           ${SMTPPATH}/isfilter.trial \
  2655.       ${SMTPPATH}/isfilter
  2656.  
  2657.     # anti spamming in v3.0
  2658.     rm -rf /etc/iscan/Spamdb
  2659.  
  2660.   else
  2661.     /etc/rc.d/init.d/sendmail stop > /dev/null
  2662.     rm -f /etc/rc.d/init.d/sendmail
  2663.  
  2664.     # restart sendmail 
  2665.  
  2666.     \cp /etc/iscan/sendmail.org /etc/rc.d/init.d/sendmail
  2667.     /etc/rc.d/init.d/sendmail start > /dev/null
  2668.  
  2669.     rm -f /etc/iscan/sendmail
  2670.     rm -f /etc/iscan/pkg/ISSMTP
  2671.   
  2672.     # remove files
  2673.     for i in $SMTPFILES ; do
  2674.       rm -f $SMTPPATH/$i
  2675.     done
  2676.   fi
  2677.  
  2678.   # now remove the directory if it is empty
  2679.   FILES=`ls $SMTPPATH`
  2680.   if [ ! -n $FILES ] ; then
  2681.     rm -rf $SMTPPATH
  2682.   fi
  2683.   \rm -f /etc/iscan/sendmail.org
  2684.  
  2685.   ISSMTP="None"
  2686.   INSTSMTP="YES"
  2687.   print "Finish removal of SMTP system."
  2688. }
  2689.  
  2690. function HTTPInstallUsingTar
  2691. {
  2692.   if [ "$ISHTTP" = "Installed" ] ; then
  2693.     if [ "$ISHTTPTRIAL" = 1 -a "$LICENSE" = "OK" ] ; then
  2694.       print "You have installed TRIAL VERSION of ISHTTP on the system."
  2695.       print -n "Do you want to upgrade to the full version of InterScan VirusWall for HTTP? > "
  2696.       read RESP
  2697.       ChkResp $RESP "no"
  2698.       if [ "$RESP" = "YES" ] ; then
  2699.         StartRemove "HTTP"
  2700.         HTTPPKG="ishttp.tz"
  2701.       else
  2702.         return
  2703.       fi
  2704.     elif [ "$LICENSE" = "OK" ] ; then
  2705.       print "Full version of InterScan VirusWall for HTTP is already installed."
  2706.       print "To reinstall ISHTTP, please remove the package first."
  2707.       return
  2708.     fi
  2709.   else
  2710.     if [ "$LICENSE" = "OK" ] ; then
  2711.       HTTPPKG="ishttp.tz"
  2712.     else
  2713.       print -n "Do you want to install the trial version for HTTP? > "
  2714.       read RESP
  2715.       ChkResp $RESP "NO"
  2716.       if [ "$RESP" = "YES" ] ; then
  2717.         ISHTTPTRIAL="YES"
  2718.         HTTPPKG="ishttp.evl"
  2719.       else
  2720.         return
  2721.       fi
  2722.     fi
  2723.   fi
  2724.  
  2725.   # is the source in the current directory?
  2726.   if [ ! -s ./$HTTPPKG ] ; then
  2727.     print "InterScan HTTP system ($HTTPPKG) not found in current directory." 
  2728.     return
  2729.   fi
  2730.  
  2731.   print "Start installation of HTTP system."
  2732.  
  2733.   # if the target path does not exist, create it
  2734.   if [ ! -d $HTTPPATH ] ; then
  2735.     mkdir $HTTPPATH
  2736.   fi
  2737.  
  2738.   # remove all files from support directory
  2739.   rm -rf /tmp/iscan_support
  2740.   mkdir /tmp/iscan_support
  2741.  
  2742.   # untar the package files
  2743.   /bin/zcat < ./$HTTPPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null )
  2744.  
  2745.   # set file ownership and modes
  2746.   chown -R root /tmp/iscan_support/*
  2747.   chgrp -R bin /tmp/iscan_support/*
  2748.   chmod -R 555 /tmp/iscan_support/*
  2749.  
  2750.   # copy files to final destination
  2751.   \cp /tmp/iscan_support/* $HTTPPATH
  2752.  
  2753.   if [ "$HTTPPKG" = "ishttp.evl" ] ; then
  2754.     HTTP_ORIG=${HTTPPATH}/ishttpd.trial
  2755.   else
  2756.     HTTP_ORIG=${HTTPPATH}/ishttpd
  2757.   fi
  2758.  
  2759.   rm -f /etc/iscan/ishttpd
  2760. #  LINUX BUG
  2761. #  ln -s $HTTP_ORIG /etc/iscan/ishttpd
  2762.   cp $HTTP_ORIG /etc/iscan/ishttpd
  2763.   \rm -f $HTTP_ORIG
  2764.  
  2765.   chmod 555 /etc/iscan/ishttpd
  2766.   chown root /etc/iscan/ishttpd
  2767.   chgrp sys /etc/iscan/ishttpd
  2768.  
  2769.   rm -f /etc/rc.d/init.d/iscanhttpproxy
  2770.   ln -s ${HTTPPATH}/iscanhttpproxy /etc/rc.d/init.d/iscanhttpproxy
  2771.   chmod 744 /etc/rc.d/init.d/iscanhttpproxy 
  2772.   chown root /etc/rc.d/init.d/iscanhttpproxy 
  2773.   chgrp sys /etc/rc.d/init.d/iscanhttpproxy 
  2774.   rm -f /etc/rc.d/rc3.d/S992IScanHTTP
  2775.   ln -s /etc/rc.d/init.d/iscanhttpproxy /etc/rc.d/rc3.d/S992IScanHTTP
  2776.   rm -f /etc/rc.d/rc0.d/K992IScanHTTP
  2777.   ln -s /etc/rc.d/init.d/iscanhttpproxy /etc/rc.d/rc0.d/K992IScanHTTP
  2778.   chmod 744 /etc/rc.d/rc3.d/S992IScanHTTP /etc/rc.d/rc0.d/K992IScanHTTP
  2779.   chown root /etc/rc.d/rc3.d/S992IScanHTTP /etc/rc.d/rc0.d/K992IScanHTTP
  2780.   chgrp sys /etc/rc.d/rc3.d/S992IScanHTTP /etc/rc.d/rc0.d/K992IScanHTTP
  2781.  
  2782.   echo $HTTPPATH > /etc/iscan/pkg/ISHTTP
  2783.   ISHTTP="Installed"
  2784.   INSTHTTP="NO"
  2785.   print "Finish installation of HTTP system."
  2786. }
  2787.  
  2788. function HTTPRemoveUsingTar
  2789. {
  2790.   if [ -f /etc/iscan/pkg/ISHTTP ] ; then
  2791.     HTTPPATH=`cat /etc/iscan/pkg/ISHTTP`
  2792.   else
  2793.     print $BOLD
  2794.     print "Cannot remove HTTP; /etc/iscan/pkg/ISHTTP not found."
  2795.     print $UNBOLD
  2796.     PressAnyKey
  2797.     return
  2798.   fi
  2799.  
  2800.   print "Start removal of HTTP system."
  2801.  
  2802.   # stop daemon
  2803.   /etc/rc.d/init.d/iscanhttpproxy stop > /dev/null
  2804.  
  2805.   rm -f /etc/rc.d/init.d/iscanhttpproxy     \
  2806.         /etc/rc.d/rc3.d/S992IScanHTTP       \
  2807.         /etc/rc.d/rc0.d/K992IScanHTTP       \
  2808.         /etc/iscan/ishttpd              \
  2809.         /etc/iscan/pkg/ISHTTP
  2810.  
  2811.   # remove http files
  2812.   for i in ${HTTPFILES} ; do
  2813.     rm -f $HTTPPATH/$i
  2814.   done
  2815.  
  2816.   # now remove the directory if it is empty
  2817.   FILES=`ls $HTTPPATH`
  2818.   if [ ! -n $FILES ] ; then
  2819.     rm -rf $HTTPPATH
  2820.   fi
  2821.  
  2822.   ISHTTP="None"
  2823.   INSTHTTP="YES"
  2824.   print "Finish removal of HTTP system."
  2825. }
  2826.  
  2827. function TVCSInstallUsingTar
  2828. {
  2829.   # is the source in the current directory?
  2830.   if [ ! -s ./$TVCSPKG ] ; then
  2831.     print "InterScan TVCS system ($TVCSPKG ) not found in current directory."
  2832.     return
  2833.   fi
  2834.  
  2835.   print "Start installation of TVCS system."
  2836.  
  2837.   # if the target path does not exists, create it
  2838.   if [ ! -d $TVCSPATH ] ; then
  2839.     mkdir $TVCSPATH
  2840.   fi
  2841.  
  2842.   # remove all files from support directory
  2843.   rm -rf /tmp/iscan_support
  2844.   mkdir /tmp/iscan_support
  2845.  
  2846.   # untar the package files
  2847.   /bin/zcat < ./$TVCSPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null )
  2848.  
  2849.   # set file ownership and modes
  2850.   chown -R root /tmp/iscan_support/*
  2851.   chgrp -R bin /tmp/iscan_support/*
  2852.   chmod -R 555 /tmp/iscan_support/*
  2853.  
  2854.   # copy files to final destination
  2855.   \cp /tmp/iscan_support/* $TVCSPATH
  2856.  
  2857.   # link files to cgi-bin directory of admin package
  2858.   TVCS_CGI="Register SolarCommand tvcscfg tvcsinfo.cgi tvcsreg.cgi tvcsun_set.cgi tvcsunint.cgi TvcsRetrieve.exe"
  2859.   for i in ${TVCS_CGI} ; do
  2860.     ln -s ${TVCSPATH}/$i ${ADMINPATH}/cgi-bin
  2861.   done
  2862.   
  2863.   TVCSFILES="vcagt solar.ini tvcs_unint.sh"
  2864.   for i in ${TVCSFILES} ; do
  2865.     ln -s ${TVCSPATH}/$i /etc/iscan/$i
  2866.     chmod 544 /etc/iscan/$i
  2867.     chown root /etc/iscan/$i
  2868.     chgrp sys /etc/iscan/$i
  2869.   done
  2870.  
  2871.   ln -s ${TVCSPATH}/iscantvcsagt /etc/rc.d/init.d/iscantvcsagt
  2872.   chmod 755 /etc/rc.d/init.d/iscantvcsagt
  2873.   chown root /etc/rc.d/init.d/iscantvcsagt
  2874.   chgrp sys /etc/rc.d/init.d/iscantvcsagt
  2875.   rm -f /etc/rc.d/rc3.d/S993IScanTVCS
  2876.   ln -s /etc/rc.d/init.d/iscantvcsagt /etc/rc.d/rc3.d/S993IScanTVCS
  2877.   rm -f /etc/rc.d/rc0.d/K993IScanTVCS
  2878.   ln -s /etc/rc.d/init.d/iscantvcsagt /etc/rc.d/rc0.d/K993IScanTVCS
  2879.   ln -s $TVCSPATH/tvcs /etc/iscan/.tvcs
  2880.   chmod 755 /etc/iscan/.tvcs
  2881.   chown root /etc/iscan/.tvcs
  2882.   chgrp bin /etc/iscan/.tvcs
  2883.  
  2884.   # Append solar.ini to intscan.ini
  2885.   cat /etc/iscan/solar.ini >> /etc/iscan/intscan.ini
  2886.  
  2887.   echo $TVCSPATH > /etc/iscan/pkg/ISTVCS
  2888.   ISTVCS="Installed"    
  2889.   INSTTVCS="NO"
  2890.   print "Finish installation of TVCS system."
  2891.   print
  2892.   print "\tNote: Be sure to register the TVCS Agent"
  2893.   print "\t      from the Web configuration page."
  2894. }
  2895.  
  2896. function TVCSRemoveUsingTar
  2897. {
  2898.   if [ -f /etc/iscan/pkg/ISTVCS ] ; then
  2899.     PATHTVCS=`cat /etc/iscan/pkg/ISTVCS`
  2900.   else 
  2901.     print $BOLD
  2902.     print "Cannot remove TVCS; /etc/iscan/pkg/ISTVCS not found."
  2903.     print $UNBOLD
  2904.     PressAnyKey
  2905.     return
  2906.   fi
  2907.  
  2908.   print "Start removal of TVCS system."
  2909.  
  2910.   # remove tvcs links in cgi-bin directory of admin package
  2911.   TVCS_CGI="Register SolarCommand tvcscfg tvcsinfo.cgi tvcsreg.cgi tvcsun_set.cgi tvcsunint.cgi TvcsRetrieve.exe"
  2912.   for i in ${TVCS_CGI} ; do
  2913.     rm -f ${ADMINPATH}/cgi-bin/$i
  2914.   done
  2915.  
  2916.   CGIPATH=`cat /etc/iscan/pkg/ISADMIN`
  2917.   /etc/rc.d/init.d/iscantvcsagt stop
  2918.   rm -f /etc/iscan/ip                   \
  2919.         /etc/iscan/vcagt                \
  2920.         /etc/iscan/solar.ini            \
  2921.         /etc/iscan/.tvcs                \
  2922.         /etc/iscan/pkg/ISTVCS           \
  2923.         /etc/iscan/tvcs_unint.sh        \
  2924.         /etc/rc.d/init.d/iscantvcsagt       \
  2925.         /etc/rc.d/rc0.d/K993IScanTVCS       \
  2926.         /etc/rc.d/rc3.d/S993IScanTVCS       \
  2927.         ${CGIPATH}/cgi-bin/Register     \
  2928.         ${CGIPATH}/cgi-bin/SolarCommand
  2929.  
  2930. ed /etc/iscan/intscan.ini <<EOF >/dev/null 2>/dev/null
  2931. /\[TVCS
  2932. .,+19d
  2933. .
  2934. w
  2935. q
  2936. EOF
  2937.     
  2938.   # remove tvcs files
  2939.   TVCSFILES="ISCANTVCSAGT Register ip solar.ini vcagt SolarCommand iscantvcsagt tvcs_unint.sh .tvcs register.gif tvcs tvcscfg tvcsinfo.cgi tvcsreg.cgi tvcsun_set.cgi tvcsunint.cgi uninstall.gif"
  2940.   for i in ${TVCSFILES} ; do
  2941.     rm -f ${PATHTVCS}/$i
  2942.   done
  2943.  
  2944.   # now remove the directory if it is empty
  2945.   TVCSFILES=`ls $PATHTVCS`
  2946.   if [ ! -n $TVCSFILES ] ; then
  2947.     rm -rf $PATHTVCS
  2948.   fi
  2949.  
  2950.   ISTVCS="None"
  2951.   INSTTVCS="YES"
  2952.   print "Finish removal of TVCS system."
  2953. }
  2954.  
  2955. #==================== END ROUTINES FOR TAR INSTALLATION ========================
  2956.  
  2957. #=======================================================#
  2958. # CheckLicense prompts the user for a software license. #
  2959. #=======================================================#
  2960. function CheckLicense
  2961. {
  2962.   if [ ! -s /etc/iscan/license ] ; then
  2963.     print "License program not found."
  2964.     return
  2965.   fi
  2966.  
  2967.   loop=true
  2968.   while [ $loop = true ] ; do
  2969.     loop=false
  2970.     print -n "Please input your serial number for InterScan: "
  2971.     /etc/iscan/license > /dev/null
  2972.     if [ "$?" = "0" ] ; then
  2973.       LICENSE="OK"
  2974.     else
  2975.       print "The serial number entered is invalid. Do you want to re-enter the"
  2976.       print -n "     serial number? (Yes/No) > "
  2977.       read RESP
  2978.       ChkResp $RESP NO
  2979.       if [ "$RESP" = "YES" ] ; then
  2980.         loop=true
  2981.       fi
  2982.     fi
  2983.   done
  2984.  
  2985.   if [ "$LICENSE" = "NOTOK" ] ; then
  2986.     print "The serial number is invalid. You will only be able to install the"
  2987.     print "     trial versions of InterScan."
  2988.   fi
  2989. }
  2990.  
  2991. ########        Main Program    ########
  2992.  
  2993. function ignorehup {
  2994. #     trap ignorehup INT
  2995.     Main
  2996. }
  2997.  
  2998. # check user ID
  2999. id | grep root > /dev/null 2>&1
  3000. if [ $? -ne 0 ]
  3001. then
  3002.     echo "You must be super-user (root) to execute this script."
  3003.     PressAnyKey
  3004.     exit 1
  3005. fi
  3006. # trap ignorehup INT
  3007.  
  3008. # create temporary support directory
  3009. rm -rf /tmp/iscan_support
  3010.  
  3011. # launch first menu
  3012. echo "start Main"
  3013. Main
  3014.